access JavaScript variable in new window -


this first javascript attempt, apologize if things little mangled.

i have 2 html pages (certificate1.html , certificate2.html). i'm trying prompt user his/her name on certificate1.html, pass information certificate2.html. @ point user's name displayed in certificate (s)he can print.

both html pages reference same javascript file (certificate1.js). first page calls passname():

function passname() {     firstn = document.frmusername.infirstn.value;     lastn = document.frmusername.inlastn.value;    // alert(firstn); //    // alert(lastn); //     var cert = window.open("certificate2.html");     cert.firstn = firstn;     cert.lastn = lastn;     //alert(cert.firstn); //good     //alert(cert.lastn); //good } 

this seems working correctly. i'm stuck function placename() certificate2.html calls. have firing onload, , know it's accessing function correctly (i stuck alert in there , came up). don't know how access firstn , lastn variables passed cert in passname(). i've tried document.firstn "undefined." how can access firstn , lastn variables (think i) passed?

thanks! -kristin

update:

got it!!!

i didn't need access via window.opener - had passed in variables window, able access them directly.

function placename() {     //alert(firstn);     document.getelementbyid("pusername").innerhtml = firstn + " " + lastn; } 

thanks guys!! -kristin

html localstorage (html5) http://diveintohtml5.info/storage.html

in first file :

localstorage.setitem("firstn", document.frmusername.infirstn.value); 

in second 1 :

var firstn = localstorage.getitem("firstn"); 

or set cookies...

http://www.w3schools.com/js/js_cookies.asp

but think should done using php or @ least not js


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -