|
December 2006 Technical Tip – JavaScript: Passing data between pages The example contained in this article shows how to pass data between pages when using JavaScript. Here is the sending page. I've typed Hello world in the text box before clicking on the button:
Here is the code which created the sender. Note the use of onsubmit="dosubmit()". The name of this method is significant. The URL of the next page is assigned to document.myform.action. Setting window.event.returnValue to true causes the submit to take place.
Here is the receiving page. Note how Hello%20world appears in the URL. Spaces are encoded as %20. Other selected special characters are similarly "escaped".
Here is the code which created the receiver. Note the JavaScript code which must appear after the form. The unescape method is used to decode the escaped characters.
We hope you will consider Caliber Data Training when you are in need of high quality HTML and JavaScript training. Go to the articles index. Written by Bill Qualls. Copyright © 2006 by Caliber Data Training 800.938.1222 |