re*****@cox.net wrote:
Isn't JScript a client-side scripting language?
I really need to be able to do this on the server-side.
...or did I misunderstand your solution?
JScript is availabel as a scripting language in ASP. I use it exclusively.
Now, I am not saying you need to change languages (though I think the
benefits of using JScript for ASP are many). ASP actually allows you to use
both languages in the same script. There are some rules to keep in mind,
however.
To begin with, understand that there are three distinctly different types of
scripting blocks:
1. <script runat="server" language="jscript"... </script>
2. <script runat="server" language="vbscript"... </script>
3. <% ... %>
I will refer to #3 as "inline" from here on.
When the script is parsed, the parser determines the language for inline
scripting, then executes the blocks in the following order: 1-3-2 (if inline
language is VBScript), or 2-3-1 (if JScript). HOWEVER, any block can call a
function from any other block. It does not matter what order the blocks
appear within the script.
If you want to mix-and-match languages, then, it is a good practice to
encapsulate the cross-language bits in functions:
<%@Language=VBScript%><%
Randomize
Dim N : N = 100 * Rnd()
Response.Write(FormatEXP(N,10))
%>
<script runat="server" language="jscript">
function FormatEXP(n,d) {
return n.toExponential(d)
}
</script>
--
Dave Anderson
Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.