![]() |
|
|
|
||||||||||
![]() |
|
|
Thread Tools |
|
#1
|
|||
|
|||
|
Passing variables from pop-up window to parent window.
Hello,
I made a code to pass variables from pop-up window to parent window. Unfortunately this code is only working on Mozilla FireFox and not Internet Explorer. Can anyone help in this? JavaScript function to pass variables and close pop-up window: Code:
function setValues()
{
var txt = document.getElementById("text").value;
var font_size = document.getElementById("font_size").value;
var font = document.getElementById("font");
font = font.options[font.selectedIndex].value;
var text_location = document.getElementById("text_location");
text_location = text_location.options[text_location.selectedIndex].value;
var color = document.getElementById("color").value;
if (txt.length < 1 || font.length < 1 || font_size.length < 1 || font_size.toInt() < 1 ||
font.length < 1 || text_location.length < 1 || color.length != 7 || color[0] != '#')
{
alert("Please fill out all the fields correctly!");
return false;
}
var ncolor = parseInt(color.substr(1,2), 16) + "," + parseInt(color.substr(3,2), 16) + "," + parseInt(color.substr(5,2), 16);
opener.document.getElementById("text").value = txt;
opener.document.getElementById("font").value = font;
opener.document.getElementById("font_size").value = font_size;
opener.document.getElementById("text_location").value = text_location;
opener.document.getElementById("color").value = ncolor;
self.close();
return false;
}
|
|
#2
|
|||
|
|||
|
I do this with the following script, it works in IE:
Main page: html4strict Code:
html4strict Code:
|
|
#3
|
|||
|
|||
|
Thanks for your help Dave but I dont think this is working with me.
Anybody else can help? |
|
#4
|
||||
|
||||
|
Not working for me either
|
|
#5
|
|||
|
|||
|
Tested in IE and FF;
file t1.html Code:
<!--compatibility mode-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<body>
<form>
<input id="details" name="details">
<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>
Code:
<!--compatibility mode-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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>
__________________
Rene7705, creator of visCanvasLoaderIcon (free), buttonAnimated (free) and (299 euro/site) |
|
#6
|
|||
|
|||
|
That works. Thanks for helpful info.
|
|
#7
|
|||
|
|||
|
how to get the pop window value to the frame in parent window?
thanks in advance... |
|
#8
|
|||
|
|||
|
Code:
<!--compatibility mode-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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>
|
|
#9
|
|||
|
|||
|
is this code still work?
__________________
Hidden Truth of Getting No.1 Spot On Google Within 12 Hours Exposed |
|
#10
|
|||
|
|||
|
very old thread, is it still work?
|
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Auto-sizing pop-up window? | digitalpoint | JavaScript | 9 | Nov 11th 2008 5:03 pm |
| Accessing a element of parent window in child window | livehed | Programming | 0 | Jun 28th 2005 7:49 am |
| New Window | justtara | AdSense | 14 | Mar 26th 2005 12:04 pm |
| Passing hidden variables using the get method | david_sakh | PHP | 5 | Jan 9th 2005 9:08 pm |
| Making a pop up(with close window button) | ginostylz | JavaScript | 10 | Sep 8th 2004 7:06 pm |