Hello,
On htm1.htm I have
<html>
<head><title>htm1.htm</title></head>
<body>
<form name="myFormA" action="htm2.htm" method="get">
<input type="text" name="billy" size="70">
<input type="submit" value="Submit">
</form>
</body>
<html>
and here is htm2.htm
<html>
<head><title>htm2.htm</title></head>
<body>
<form name="myFormB">
<input type="text" name="axel" size="70">
</form>
</body>
<html>
Is it possible for htm2.htm to read the url passed in from htm1.htm without
using asp? Without using a Response object - say just using javascript to
read the value pair? If so, what would the javascript code look like?
Thanks,
Rich
davehagemann@gmail.com - 06 Dec 2005 04:42 GMT
Rich,
Here's all you have to do...
For htm1.htm:
<html>
<head><title>htm1.htm</title></head>
<body>
<form name="myFormA"
action="htm2.htm?var1=document.myFormA.billy.value" method="get">
<input type="text" name="billy" size="70">
<input type="submit" value="Submit">
</form>
</body>
<html>
And for htm2.htm:
<html>
<head>
<title>htm2.htm</title>
<script language="javascript">
function loadvalue()
{
// Set the Search text from the querystring
var strQuerystring = window.location.search.substring(1);
var strNameValuePairs = strQuerystring.split("&");
if (strNameValuePairs.length >= 1)
{
strNameValuePairs = strNameValuePairs[0];
var intPos = strNameValuePairs.indexOf('=');
if (intPos >= 0)
{
var strName = strNameValuePairs.substring(0, intPos);
if (strName == 'var1')
{
var strValue = strNameValuePairs.substring(intPos + 1);
document.myFormB.axel.value = unescape(strValue);
}
}
}
}
</script>
</head>
<body onload="loadvalue()">
<form name="myFormB">
<input type="text" name="axel" size="70">
</form>
</body>
<html>
Hope that helps.
- Dave