View Full Version : Passing Variable
01-22-2005, 03:14 AM
Can Someone please help me how to pass jscript(str variable) to asp (strvar).
var w = document.log.Combo.selectedIndex;
var str = document.log.Combo.options[w].text;
I want the str variable to be
<%strVal = str %> ------------------ This is code gives me error. Can you help me with this. Thank You.
01-22-2005, 09:31 AM
i am not sure means i have not try but may be poosible with
if this will run than replay me......
01-22-2005, 09:43 AM
Hey first tell are you want this value without refreshing your page???????
if yes than its possible using request.form() object.
here abc is asp variable of which u want value.
sonal is here..... :thumbsup:
01-23-2005, 02:04 AM
Thank you sonal. i tried what you gave me but still it didnt work. I will aprreciate anybody who could help me with this. Thank you in advanced.
01-25-2005, 12:34 PM
errm... to pass a client side variable to a server side variable you need to send the variable as a form or querystring element, then read it on the serverside, ie
<form name="f" method="post">
<input type="hidden" value="" name="str">
then either use a submit button on the form (in which case the form doesnt need a name) or use a link that runs document.f.submit()
this can then be read when the page reloads with Request.Form("str")
abc = "blah"
Response.Write "<script>" & vbNewLine & "var a = " & abc & ";" & vbNewLine & "</script>
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.