In article <ui***************************@news.ks.uiuc.edu> , abbylee26
@hotmail.com enlightened us with...
My code works but because I'm using VBscript within JavaScript
Not because.
Javascript can call client-side vbscript just fine, if it's done right and IE
is the browser. See code below.
---------------within my body-------------
<script language="JavaScript">document.write(formatCurrenc y(<%=Request.Form
("total")%>))</script>
------------------------------------------
My script takes the form element "total" from the previous page and sends it
to a function for formatting. Problem is...JavaScrip just doesn't like
VBscript. How do I get the form element using JavaScript?
You don't. It has nothing to do with getting the form element. The form
element is gotten via ASP server-side VBscript. You are calling this function
as though it is client-side.
Is formatCurrency a client-side vbscript function you wrote? If not, this is
the wrong syntax to use (it needs to be in the <%= %> construct as well). If
so, check that it returns a string, as expected by document.write.
If it is a server-side function (one defined in your ASP), do this: (note the
quotes! they are important.)
document.write("<%= formatCurrency(Request.Form ("total") %>")
If it is a client-side function:
Client-side example (IE ONLY):
This works fine in IE. So, it's something you're doing wrong.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title> New Document </title>
<script type="text/vbscript">
Function sayHi (str)
sayHi = "Hi!" & str
End Function
</script>
</head>
<body>
<script type="text/javascript">
document.write(sayHi("Whee!"));
</script>
</body>
</html>
--
--
~kaeli~
Shotgun wedding: A case of wife or death.
http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace