Code Simplified – Viral Sarvaiya

Code Simplified – Viral Sarvaiya, Web Developer Friends, dot net Developer, Sql Server Developer

Posts Tagged ‘page redirection’

querystring in to javascript and HTML page Redirect.

Posted by Viral Sarvaiya on March 13, 2009


In the HTML page, we can not use the value of one page to second page without useing server side coding.

to do that we have to use javascript.

Step 1 :  Make a file1.html

<HTML>
<HEAD>
</HEAD>

<BODY>

<Form name=”frmDefault” action=”file2.htm” method=”get”>

<p>Item1: <Input Type=”text” name=”txtItem1″></p>
<p>Item2: <Input Type=”text” name=”txtItem2″></p>
<p><Input type=”submit”></p>
</Form>

</BODY>
</HTML>

step 2 : Make file2.html

<HTML>
<BODY>
<Script Language=”Javascript”>
<!–//
var arrArgs = location.search.substring(1).split(“&”);

for (var i=0; i<arrArgs.length; i++) {
document.write (‘<p>’ + arrArgs[i] + “</p>”);
}
//–>
</Script>
</BODY>
</HTML>

javascript write a value of querystring that comes to another  page.

Posted in Javascript | Tagged: , , , , , | Leave a Comment »

 
Follow

Get every new post delivered to your Inbox.

Join 44 other followers

%d bloggers like this: