Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C#3.0 ASP.NET Javascript , +
In development,javascript how to achieve value-passing between different web pages.Thank you.
Posted 28-Aug-12 23:19pm
Edited 28-Aug-12 23: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 at 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
0 OriginalGriff 690
1 Maciej Los 280
2 Suvendu Shekhar Giri 229
3 Richard Deeming 195
4 Sascha Lefévre 164
0 Sergey Alexandrovich Kryukov 9,678
1 OriginalGriff 9,135
2 Peter Leow 5,082
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 2,606

Advertise | Privacy | Mobile
Web03 | 2.8.150327.1 | Last Updated 29 Aug 2012
Copyright © CodeProject, 1999-2015
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