Code Simplified – Viral Sarvaiya

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

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: