Click here to Skip to main content
13,095,004 members (79,730 online)
Rate this:
Please Sign up or sign in to vote.
In development,javascript how to achieve value-passing between different web pages.Thank you.
Posted 28-Aug-12 22:19pm
Updated 28-Aug-12 22:22pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I am not sure if i understood your question correctly.
Assuming that you want to pass values from one page to another, you can go for query strings.
You may find the below article helpful
Passing variables between pages using QueryString[^]

Get query string values in JavaScript[^]

More links here[^]
pucx 29-Aug-12 5:53am
I pass a lot of data,if use query strings,it maybe not good?
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

hi use like this

<form name="myform" method="post" action="post.aspx">
<input name="user" value="peter"/>
<input value="cc" value="aus"/>
<a href="javascript:myform.submit()">Click</a>

function postwith (to,p) {
  var myForm = document.createElement("form");
  myForm.method="post" ;
  myForm.action = to ;
  for (var k in p) {
    var myInput = document.createElement("input") ;
    myInput.setAttribute("name", k) ;
    myInput.setAttribute("value", p[k]);
    myForm.appendChild(myInput) ;
  document.body.appendChild(myForm) ;
  myForm.submit() ;
  document.body.removeChild(myForm) ;

More Info:[^]

Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Through Javascript you will not be able to pass values between pages. You need some objects to store the values which can be shareable throughout the pages.

In this case you can use QueryString to pass the values between the pages and you can retrieve it using javascript.

Otherwise you can use various objects to pass the values from one page to another.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 29 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100