Forum Moderators: open
This is all of the code on the page:
<html>
<head>
<title>Details</title>
<script language="JavaScript" type="text/javascript">
document.getElementById("asd").src = window.opener.document.all.picName.innerText;
</script>
</head>
<body>
<img src="" alt="" border="0" name="asd" id="asd">
</body>
</html>
That's it!
For the life of me I can't figure out why the image object isn't being recognized.
Note that the value of window.opener.document.all.picName.innerText is "images/big/largebarn.jpg", and that image exists in the correct folder.
Can anyone help here?
Thanks in advance.
document.all.asd.src = window.opener.document.all.picName.innerText;
document.images.asd.src = window.opener.document.all.picName.innerText;
var asd = new image();
document.getElementById("asd").src = window.opener.document.all.picName.innerText;
document.getElementById("asd").src = window.opener.document.all.picName.innerText;
isit = "asd"
document.getElementById(isit).setAttribute( 'src', window.opener.document.all.picName.innerText );
document.getElementById("asd").src = window.opener.document.all.picName.innerText;
window.document.getElementById("asd").src = window.opener.document.all.picName.innerText;
1) Put the script block somewhere below both the image and the element, #picName.
//or//
2) Execute when the page has loaded.
onload = function()
{
// do your thing
}
BTW
Use getElementById not document.all
innerText won't work outside IE. Use innerHTML - although it too is non-standard.
document.getElementById("asd").src = window.opener.document.all.picName.innerText;
You are mixing referencing methods. Go for the modern, standards:
document.getElementById("asd").src = window.opener.document.getElementById("picName").innerText;