I'm developing a prototype website. NO server interaction or anything.
I just want to pass the keyed in data around from HTML pg1 to HTML Pg2.
Any ideas..
I'm developing a prototype website. NO server interaction or anything.
I just want to pass the keyed in data around from HTML pg1 to HTML Pg2.
Any ideas..
You could use javascript to place cookies in the users browser for use on the pages. How you would pull this off, I'm not sure but maybe someone with javascript know-how could inform us both.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
u means using document.cookie??
Perhaps, if that is the javascript way of doing it. (I'm only used to using PHP for interaction and am currently in the process of learning Javascript and AJAX.) I'm pretty sure this is the best way to do it without server side interaction.
"Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design
Yup, i found it. Just wonder if it can store array. v
http://www.dynamicdrive.com/forums/s...ocument.cookie
Another method for passing the values between page is as follows. you can use the HTML form field too to pass the values between pages
The first page
The page that gets the parameter from the first pageCode:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <a href='2.htm?Something=This is another method'>Click here</A> </body> </html>
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <SCRIPT LANGUAGE="Javascript"> function GetParam(name) { var start=location.search.indexOf("?"+name+"="); if (start<0) start=location.search.indexOf("&"+name+"="); if (start<0) return ''; start += name.length+2; var end=location.search.indexOf("&",start)-1; if (end<0) end=location.search.length; var result=location.search.substring(start,end); var result=''; for(var i=start;i<=end;i++) { var c=location.search.charAt(i); result=result+(c=='+'?' ':c); } return unescape(result); } alert(GetParam('Something')); </SCRIPT> </body> </html> The above mentioned Javascript can be described fully at http://www.cryer.co.uk
Yeah. Using a variable in the address bar makes the most sense.
I would suggest using PHP for this purpose. It's much better.
But... javascript doesn't need a server. That is the ONLY advantage, but if you need that, then that's the only real option.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Bookmarks