OMG! why can I not get this simplwe thing to work!!!! I am really rusty when It comes to Javascript so when you point out the opbvious answer I will post my address so you can come round and slap me for being an idiot! okay I have a few pages and when I enter a manual value for the variable everything else works, except I cannot pass the value automatically from the first page to the next! simpley put here is the first page: Parent HTML: <body> <script type="text/javascript"> var passed = 0 </script> <form method="get" action="child.html"> <p> Please enter how many blocks you have completed: <input name="blknumb" id="blknumb" type="text" size="25"> <input type="hidden" name="passed" id="passed" value="0" <input type="submit" value="Submit"/> </p> </form> </body> Code (markup): and here is the page to be passed to: child.html (this is just the section that recieves the value and displays it for debuggin to show the value has been passed) <html> <head> </head> <body> <script type="text/javascript"> var frmout; frmout = document.forms[blknumb]; document.write(frmout); </script> </body> Code (markup): As far as I can see, the variable 'blknumb' should be sent to child.html and displayed, what actually happens Is I get 'null' returned no matter what value I put in! Please let me know what I am doing wrong so I can oil up the rusty bits! Jimmy
look at 'similar' threads at the bottom - MMJ just replied to another one by giving a function that captures get variables in a way similar to $_GET in php...
Hi, There is a simple way to transfer a small amount of date using the window name attribute SEND function loaddata(){ window.name= "Data to be transferred" mynew="window.location= 'URL of second page'" eval(mynew) } RECEIVE you need a function that loads at the start on the page function startme() { //get data from window.name attribute mytown=window.name //set window name to blank to stop future use window.name = "" // test if the name is not blank and load it into the new form // blah blah } Its simple and works well. I can provide further details and options if you want to go this way. Cheers
It looks to me that "frmout = document.forms[blknumb];" is capturing info on the child page and not the parent page.
Thanks JDOMPer and mmerlinn! I will give the window one a shot, It looks to me like the one I could use, but to be honest, I may need to pass more than one variable, I know there is a way but I cannot remember how to do it, it got to do with the 'action=""' part and you can use it when validating forms (by sending the form data to a script in another page to be validated.) I will keep trying! Jimmy
For several simple word transfers you can simply use http://www.sendtourl.html?var1=name&var2=address etc. for more complicated transfers See http://forums.digitalpoint.com/showthread.php?p=8319260#post8319260 You don't need to use a database. This simplifies data transfers. Cheers
'?' + multiple variables added to the url separated by '&' http://www.google.com/search?hl=en&rls=com.microsoft:en-us:IE-SearchBox&q=tagalong%20tours%20in%20outback%20australia&start=10&sa=N