Click to See Complete Forum and Search --> : passing a var from html to ext. js and back to html on page load.


dptoot
06-10-2006, 04:27 PM
Well I guess the title explains it all... I was wondering how this is achieved?

I am looking to have webpage that contains a certain variable (a). On page load that that variable (a) is sent to an external javascript that contains a function that states if var="a" then 3 variables (x, y, z) should be sent back to the original html page. These 3 variables are then used throughout the pages content.

I hope this makes sense?


Here is what I am trying to achieve in another format.

When "index.html" loads there is a variable:
var PageNum= "a";

This is immediately sent to external js file (pagenumbers.js) which states:

if PageNum = "a" then send the following variables back to and be used in content of "index.html"

var x = "x";
var y = "y";
var z = "z";

So how do I go about doing that?

Thanks guys!
dptoot

M0rph3us
06-10-2006, 05:05 PM
Have you tried storing your variable in cookie?

dptoot
06-10-2006, 06:20 PM
No I haven't tried a cookie but as I am quite the novice I am not sure how that would be done... the variables that are finally sent to the HTML document denote what content is added to the page. Will a cookie provide this information. As I said I am quite new to this so any examples or instructions would be very helpful...