JavaScript - HOW we send value of page to another in java script

Asked By ALOK RANJAN on 02-Jul-12 02:38 AM
how we send a value from one page to another in javascript??

thanks 

Alok
Neha Garg replied to ALOK RANJAN on 02-Jul-12 03:00 AM

Hello Alok,

 

    <script language="JavaScript" type="text/javascript">

      function nextpage() {

        window.location.href = "send2.htm?MyValue.value='" + document.forms.myForm.MyValue.value +

        "'&MyTest.value='" + document.forms.myForm.MyTest.value + "'"

 

      }

    </script>

Jitendra Faye replied to ALOK RANJAN on 02-Jul-12 03:02 AM
Use query string  like this-

window.location="abc.aspx?value1=data1&value2=data2";
Jitendra Faye replied to ALOK RANJAN on 02-Jul-12 03:03 AM
If you want to pass more that one value then follow this link-

here you will get my article-

http://steptodotnet.blogspot.in/2012/06/passing-more-than-one-values-from-one.html
S K replied to ALOK RANJAN on 02-Jul-12 03:04 AM
you can pass value from one page to another page in javascript using query string
see more details here
http://www.javascriptkit.com/javatutors/send1.shtml 
Neha Garg replied to ALOK RANJAN on 02-Jul-12 03:05 AM

Also see the below Example:

 

Transfer te value on button click event:

 

<script language="JavaScript" type="text/javascript">

      function NavigateToNext() {

        window.location.href = "you page.aspx?Names=" + document.getElementById('TextBoxNames').value + "&CheckedItems=" + document.getElementById('TextBoxCheckedItems').value;

        return false;

      }

 

    </script>

 

Aspx code

<asp:Button .......... OnClientClick="return  NavigateToNext();" >

ALOK RANJAN replied to Neha Garg on 02-Jul-12 03:31 AM
but how we retrieve it on next page