pengiriman variabel dengan popup windows

menggunakan dua buah file, gunakan sebuah file sebagai pemicu pop-up windows (trigger), dan trigger jg dipakai sebagai windows opener yang akan menerima variabel dari windows pop-up


trigger


<!--compatibility mode-->
<html>
 <body>
<form>
 <input id="details" name="details" disabled="disabled" />
 <input type="button" name="choice"
    onClick="window.open('t2.html',
       'popuppage','width=850,toolbar=1,
        resizable=1,scrollbars=yes,height=700,
        top=100,left=100');"
    value="Open popup">
</form>
</body>
</html>

popup code


<!--compatibility mode-->
<html>
<head>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function sendValue (s){
var selvalue = s.value;
window.opener.document.getElementById('details').value = selvalue;
window.close();
}
//  End -->
</script>
<form name="selectform">
<input name="details" value="">
<input type=button value="Copy input to parent opener"
   onClick="sendValue(this.form.details);">
</form> 

</body>
</html>

Published by

G3n1k

just to remember what i had known :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s