...

View Full Version : Javascript and ASP



ecnarongi
12-16-2002, 10:10 PM
I did a search but found nothing, I guess the old db didn't get ported over from pre june 2002, I can remember that I answered this before but I guess age is catching up to me. I want to know how to access an ASP function through javascript, and I want to pass a value to the ASP function from javascript. ie.

if ( document.form.elementname.value == "" || <% ASPfunction(+document.form.elementname.value+) %> == "True")
{ //do something }

all help is appreciated, thanks.

glenngv
12-17-2002, 05:02 AM
you CAN'T do that! Since ASP code is executed on the server-side, these codes executes first to GENERATE HTML/Javascript codes on the client. The javascript codes are then executed on the client based on some user events.

What you can only do is insert ASP codes inside javascript like this:

<script>
var count = <%=recordCount%>;
var blah = "<%=strBlah%>";
var uname = "<%=GetUserName()%>";
<%=GenerateJavaScriptArray()%>
</script>

ecnarongi
12-17-2002, 04:00 PM
DOH!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum