:
: "Jose" wrote:
: : Can anyone help?
: :
: : I try to put all my function in a separate .ASP file
: : under scriptlib folder but when I call any function
: : from the such asp file do not work meanwhile
: : if I put the code inside the working asp works fine
: :
: : explain:
: : mytools.asp
: : <%SCRIPT Language="vbscript"%>
: : function abc(pParam)
: : abc = "OK"
: : end function
: : function xyz(pParam)
: : xyz = "NOT OK"
: : end function
: :
: :
: : Main ASP File
: : default.asp (Contains)
: :
: : <%
: : <script language="vbscript" scr=scriptlib/mytools.asp">
: : <font face="Verdana" size=1><%=abc("GO")%>
: : </font>
: : </script>
: : %>
:
: Jo...
:
: This is client-side vbscript. You cannot nest the <script> tag. If you
: want to call the script via a script tag, then you need to remove that
from
: the source document. Take out <script language="vbscript"></script> from
: mytools.asp.
:
: Another problem you have is syntax.
: <% %> or <script runat=server></script>, but not both.
:
: <%<script... is invalid.
:
: Change mytools.asp to:
:
: mytools.asp
: <%
: function abc(pParam)
: abc = "OK"
: end function
: function xyz(pParam)
: xyz = "NOT OK"
: end function
: %>
:
: Change default.asp to:
:
: <%@ Language=VBScript %>
: <%
: Option Explicit
: Response.Buffer = True
: %>
: <!--#include file="scriptlib/mytools.asp"-->
: <html>
: <head>
: </head>
: <body>
: <font face="Verdana" size=1><%=abc("GO")%></font>
: </body>
: </html>
:
: Or use .css
: <%@ Language=VBScript %>
: <%
: Option Explicit
: Response.Buffer = True
: %>
: <!--#include file="scriptlib/mytools.asp"-->
: <html>
: <head>
: <style type="text/css">
: .v1 { font: normal xx-small verdana }
: </style>
: </head>
: <body>
: <span class="v1"><%=abc("GO")%></span>
: </body>
: </html>
A little more info:
<script language="vbscript">
This is client-size and language on client-side has been deprecated. Use
this instead:
<script type="text/vbscript">
On the server-side, you use this:
<script language="vbscript" runat="server">
ONLY ASP code goes in between here:
<% %>
....unless you wrap the code in a Response.Write("")
<%
Response.Write("<html>" & vbCrLf)
%>
HTH...
--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center -
http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation -
http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library -
http://msdn.microsoft.com/library/default.asp