PDA

Click to See Complete Forum and Search --> : Can you use JavaScript in ASP ?


nmretd
Jun 18th, 2000, 07:52 PM
Is it possible to use JavaScript in ASP. If so can someone give me an example of how to embed the javascript code in an asp page.

thanks,
nmretd.

Mark Sreeves
Jun 18th, 2000, 09:27 PM
Yes!

eg:

<script language=javascript runat=server>

// ALL YOUR ASP IN JAVASCRIPT GOES HERE

function multiplyIt(number, factor) {

return number * factor

}

</script>

<%

response.write multiplyIt (79, 23)


%>



...and here's where I copied it from:
http://developer.irt.org/script/5815.htm

nmretd
Jun 19th, 2000, 12:48 AM
Thanks Mark, that was very helpful.

nmretd.

kb244
Jun 19th, 2000, 02:48 AM
You could also make Javascript your default serverside script by doing

<%@Language=Javascript%>

then everything you write will be javascriptin the <% %> just in case you'd like to write it all in javascript.