Sublime directory Surf the web anonymous Pagerank Monitor


How do I pass data between JavaScript pages?

alisha0512
Tue 12 August 2008, 03:08 pm GMT +0200
Please anybody tell me that how can i pass the data between javascript pages?

tricks.computer
Mon 15 September 2008, 02:28 pm GMT +0200
use HTML editor and past into your BODY tag...


<spam />

olaf
Tue 16 September 2008, 10:06 am GMT +0200
Please anybody tell me that how can i pass the data between javascript pages?

I'm not so good in client site code, but you could write a cookie or use the querystring

alesianlarken
Fri 3 October 2008, 01:42 pm GMT +0200
you can pass it using urls code like by placing the questions marks at the end of the urls..

jqueryHowto
Sat 18 April 2009, 01:26 pm GMT +0200
Quote from: alisha0512
Please anybody tell me that how can i pass the data between javascript pages?

Could you be more specific. What are you trying to achieve ?! Do you want one js variable to be available in some other web page ?

gaurav467
Tue 5 April 2011, 02:11 pm GMT +0200
JavaScript page has retrieved some information from the user. Now you want to display another JavaScript page, which should also use that information. How do you pass it from the first page to the second? There are three simple solutions. The first two are safe and effective, with advantages and disadvantages to each.

summerwilkins
Wed 8 June 2011, 07:36 pm GMT +0200
You could pass the data using body tags. If the case is passing data between JS page to another JS page.

steve19
Sun 12 June 2011, 07:07 am GMT +0200
Im also new to Java can any one help

danim
Tue 28 June 2011, 10:25 am GMT +0200
i am also new to that..

Florinda
Thu 18 August 2011, 11:21 am GMT +0200
passdata1a.html

<script>
var data = new Array();
data[0] = "one, a datum";
data[1] = "two, a deer";
data[2] = "three, a slash: \\";
data[3] = "four has quotes: \"I forget what four was for\"";
</script>
<form name="data" method="POST" action="passdata1b.php">
<input type="hidden" name="data">
</form>
<script>
function sendData()
{
  // Initialize packed or we get the word 'undefined'
  var packed = "";
  for (i = 0; (i < data.length); i++) {
    if (i > 0) {
      packed += ",";
    }
    packed += escape(data[i]);
  }
  document.data.data.value = packed;
  document.data.submit();
}
</script>
<h1>This is what the array contains:</h1>
<ul>
<script>
  for (i = 0; (i < data.length); i++) {
    document.write("<li>" + data[i] + "</li>\n");
  }
</script>
</ul>
<a href="javascript:sendData();">Go to passdata1b.php</a>

passdata1b.php

<?php
  $packed = $_POST['data'];
  $data = split(",", $packed);
  for ($i = 0; ($i < count($data)); $i++) {
    # Undo what JavaScript's escape() function did
    $data[$i] = rawurldecode($data[$i]);
    # Slashes need escaping when they appear in code
    $data[$i] = str_replace("\\", "\\\\", $data[$i]);
    # Quotes need escaping too
    $data[$i] = str_replace("\"", "\\\"", $data[$i]);
  }
?>
<script>
  var data = new Array (
<?php
  for ($i = 0; ($i < count($data)); $i++) {
    if ($i > 0) {
      echo ",\n";
    }
    echo "    \"";
    echo $data[$i];
    echo "\"";
  }
?>

  );
</script>
<h1>This is what the data contains:</h1>
<ul>
<script>
  for (i = 0; (i < data.length); i++) {
    document.write("<li>" + data[i] + "</li>\n");
  }
</script>
</ul>

netshet
Thu 18 August 2011, 11:33 am GMT +0200
Sounds like this would be far more easily done using CGI (make the form action a cgi script. This will pick up the details passed and generate a dynamic page containing them)

Archive for SMF v1.00 by N.P. Valid XHTML 1.0 Transitional