I’m doing the following things:
1) A user clicks on a page and it opens up a pop-up.
2) In the pop-up I try to set a text box in the parent page.
The problem is that the code works in IE, but does not work in Fire Fox. I am testing with FF 3.6.13. I’m assuming it has to do something with the window.opener.document.getElementById or self.opener.document.getElementById. I tried both lines they don’t work in FF.
function passValues(comment_text_box_id)
{
var checkbox_values = "";
for(i=0; i<document.form1.elements.length; i++)
{
if(document.form1.elements[i].type=="checkbox")
{
if(document.form1.elements[i].checked == true)
{
if(checkbox_values == ""){
checkbox_values = document.form1.elements[i].value;
}
else{
checkbox_values = checkbox_values + "," + document.form1.elements[i].value;
}
}
}
}
//window.opener.document.getElementById(comment_text_box_id).innerText = window.opener.document.getElementById(comment_text_box_id).innerText + checkbox_values;
self.opener.document.getElementById(comment_text_box_id).innerText = self.opener.document.getElementById(comment_text_box_id).innerText + checkbox_values;
}
innerText is only supported by MSIE. In other browsers create a TextNode containing the given text and insert the TextNode into the target-element.
Replace the last line with:
(or use innerHTML if the text doesn’t contain html-markup)