faqts : Computers : Programming : Languages : JavaScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

60 of 131 people (46%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

how to pass javascript/form variables values to pop-up window

Apr 6th, 2008 20:02
ha mo, Colin Fraser, Varun Khanna,


Firstly, open the new window using an opener : 
<script language="JavaScript"><!--
var newWin;
function winOpener(mypage,nwin) {
    newWin=open(mypage,nwin,'resizable=no,width=300,height=300');
}
//--></script>
using a button in your form : 
<form name="aForm">
....
<input type="button" value="Next Window"
onClick="winOpener('newpage.htm','newwindow')">
</form>
That opens the new window using whatever particular file you want with a
name of 'newwindow'. Then to access a variable in the new window from
the original window:
    var aVar = newWin.aForm.fieldname.value;
Name the opener, name the form, name the field, and access the value,
assigning that value to a variable named aVar. 
Good luck..
http://www.businessian.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com
http://www.healthinhealth.com