I have a page to which two parameters are being passed ex
index.html?var1=xxx&var2=yyy. Could someone let me know how to capture these
two parameter values in the HTML page so that I could create two hidden
variables like var3, var4 and assign the values of var1 & var2 respectively.
These hidden variables (var3 & var4) are again being used in the html page to
call another page ex: index2.html?var3=(value captured from var1)&var4=(value
captured from var2).
I had achieved this by using server side script when running on IIS
example:
in index.html
var3=<%=Request.QueryString("var1")%>
var4=<%=Request.QueryString("var2")%>
This was working fine as the page was a ASP file. Now we have to achieve the
same without ASP code. Can someone tell me if it can be acheived using
Javascript, if so, how.
Sreeram
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
At the beginning of your loading process:
var temp = window.location.search.substring(1); // dispose of 1st "?"
var params = temp.split("&");
// this leaves you with
// params[0] => var1=xxx where xxx represents a number
// params[1] => var2=yyy where yyy represents a number
-- Take this shortcut:
eval("window." + params[0]); // eval("window.var1=123")
eval("window." + params[1]); // eval("window.var2=456")
you can now reference your variables like:
newVar1 = var1;
newVar2 = var2;
What this does is essentially prototype the variables into the window
object.
If you pass a string value, enclose variable values in quotes
("index.html?var1='a string'&var2='more'").
[I did not test the eval technique with IE]
Hope this helps,
Fox
**************
<INPUT TYPE="HIDDEN" NAME="var3" VALUE=<%request.querystring("var1")%>>
How do I achieve this using the javascript.
Sreeram
In article <36006E12...@eatel.net>,