Data to popup

Intro
Passing Data
Name & Value
Muliple Elements
Variable & Value
 
Data to Popup
Data from Popup
Opener
Arrays
Form Method
 
Passing data to a popup is just about the same as to another document except that the document is opened in a popup.

Pass a string || Pass a number

In this document.

<a href="#null" onclick="window.open('page2.htm?Hello World','win1','left=300,top=100,width=300,height=300')">Pass a string</a>

<a href="#null" onclick="window.open('page2.htm?1 2 3 4 5','win1','left=300,top=100,width=300,height=300')">Pass a number</a>

In page2.htm.

<script type="text/javascript">
<!--
var dataPassed = ''
if (location.search.length > 0)
dataPassed = unescape(location.search.substring(1))
document.write(dataPassed)
//-->
</script>


Pass Data

<script type="text/javascript">
<!--
function passData() { var sum=3*5 var str="Data Passed To Document" +"<P>A B C D E " +"<P>1 2 3 4 5" +"<P>" + sum; window.open('page2.htm' + '?' + escape(str),'win1','left=300,top=100,width=300,height=300') } //--> </script> <a href="#null" onclick="passData()">Pass Data</a>