FRYO
Oct 25th 2005, 12:48 pm
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:
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;
}
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:
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;
}