Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing Javascript to ASP on same page?

Status
Not open for further replies.

craigward

Programmer
Nov 13, 2007
230
GB
Hi,

Is there a simple way of passing javascript to asp on the same page, for example:

Code:
<html>
<head>
    <script language="JavaScript">	
     
      a = "test"
     
    </script>
</head>

<body>
<%
response.write(Javascript variable here)
%>
</body>
</html>

 
I very much doubt it.
Javascript is executed on client-side, while asp-vbscript is executed on server-side.
This means that the ASP code is long executed and rendered to HTML before the Javascript code is executed.

You'd need a time machine.

Someone correct my if I'm wrong on this.



[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Absolutely correct. The ASP code is executed on the server, and the results passed to the client where the Javascript is processed. The server and client do NOT communicate through a web page unless you use AJAX or a Java (NOT Javascript) applet.

Lee
 
think of the communication between server and client as a telephone conversation. on one end you have caller 1, who speaks into the phone, sending data through wires to caller 2. once caller 2 receives the information, he/she processes the information and responds, by sending information back through the wires.

when you're on the phone with someone, you can't reach through and hand the caller something - you'll need to send it through the wires, as always.

 
Thanks for that. I got round it another way now so i can forget passing javascript.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top