Hi,
I’ve been trying (and searching for a solution) for days now, but no luck.
I need to:
click a link (done)
open a new window (done)
write somevalue to that new window (not done in firefox 3.6 …)
This is the code I use to open the new window:
function poptastic(url)
{
var newwindow=window.open(url,'name','height=400,width=200');
//newwindow.document.write('<p>This page was generated by the main window.</p>');
newwindow.document.getElementById("teksthier").innerHTML="hier dan";
// var element = newwindow.document.getElementById("teksthier");
//element.setAttribute('tekst hier', element.value);
//newwindow.document.getElementById('teksthier').firstChild.data = "joehoeee";
//var newdiv=newwindow.document.createElement("div")
//var newtext=newwindow.document.createTextNode("A new div")
//newdiv.appendChild("woensdag") //append text to new div
//newwindow.document.getElementById("tekstdaar").appendChild(newdiv) //append new div to another div
//var theDiv = newwindow.document.getElementById("tekstdaar");
//var existingHtml;
//existingHtml = 'donderdag';
//var j = newwindow.document.createTextNode(existingHtml);
//theDiv.appendChild( j );
newwindow.document.forms['form1'].elements['tekst1'].value = "dit hier";
//document.body.innerHTML
// var target =newwindow.document.getElementById("teksthier");
//target.innerHTML = "ook hier dus";
if (window.focus) {newwindow.focus()}
}
</script>
All the // lines I’ve tried already, none work in Firefox 3.6.
This is the doc I open, where somevalue needs to be, somewhere, anywhere!
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<HEAD>
....
</HEAD>
hallo <BR>
<A HREF="#" onclick="chooselink('Media/gallery/40.jpeg'); return false">
<img src="gallery/40.jpeg"></a>
<div id="teksthier"></div>
<div id="tekstdaar">daarja</div>
<form id="form1">
<input type="text" id="tekst1"> </input>
</form>
</html>
I cannot let javascript write the entire content of the opened page. It really needs to put somevalue somewhere so it can be used.
Anyone?
Thanks.
Confuus