I've recently started learning JavaScript to get a portfolio done and run into a problem I just can't solve...
I have a bunch of thumbnails whose linked images and their links (with pop-up windows) should change along what section the viewer's at. I've gotten the pictures to work perfectly with a function that changes them with the document.getElementById('x').src="x.jpg" bit but for some reason, when I get a link by its id and change the onClick value (the code I'm using is document.getElementById('kuva2').onClick="javascript:window.open('digital-paintings/1.htm','dip1','toolbar=0,scrollbars=0,width=850,height=700')"; ), nothing happens. By typing javascript: to Mozilla's address box I get no errors though.
In case it's necessary, here's one image's slice of the function with the linked image code it refers to:
function digitalpaintings () {
document.getElementById('kuva1').src="thumbnails/dip1.jpg";
document.getElementById('linkki1').onClick="javascript:window.open('digital-paintings/1.htm','dip1','toolbar=0,scrollbars=0,width=850,height=700')";
}
...
<a href="#" id="linkki1" onClick=""><img id="kuva1" src="layout/spacer.gif" width="100" height="100" style="position:absolute; left:0; top:5;" border="0"></a>
I have a bunch of thumbnails whose linked images and their links (with pop-up windows) should change along what section the viewer's at. I've gotten the pictures to work perfectly with a function that changes them with the document.getElementById('x').src="x.jpg" bit but for some reason, when I get a link by its id and change the onClick value (the code I'm using is document.getElementById('kuva2').onClick="javascript:window.open('digital-paintings/1.htm','dip1','toolbar=0,scrollbars=0,width=850,height=700')"; ), nothing happens. By typing javascript: to Mozilla's address box I get no errors though.
In case it's necessary, here's one image's slice of the function with the linked image code it refers to:
function digitalpaintings () {
document.getElementById('kuva1').src="thumbnails/dip1.jpg";
document.getElementById('linkki1').onClick="javascript:window.open('digital-paintings/1.htm','dip1','toolbar=0,scrollbars=0,width=850,height=700')";
}
...
<a href="#" id="linkki1" onClick=""><img id="kuva1" src="layout/spacer.gif" width="100" height="100" style="position:absolute; left:0; top:5;" border="0"></a>