click

How to link to images:

<a href="required/big.jpg" onclick="window.open('required/image_viewer.htm?big.jpg',null,1); return false;">
<img src="required/small.jpg" border="0" alt="click"></a>

In this part of the above code "window.open('required/image_viewer.htm?big.jpg',null,1); you need to change the query string (after the ?) to point to the file you want to open relative to the image_viewer.htm file.

Code for image_viewer.htm

<html>
<head>
<title>Image Viewer</title>

<script language="javascript" type="text/javascript">

document.oncontextmenu = IE; //IE
if (!document.all) { //NN & Mozilla
document.captureEvents(Event.MOUSEDOWN);document.onclick = NN;
}

function IE() { //IE
if (document.all) {
return false;
}
}

function NN(e) { //NN & Mozilla
if (e.which==2||e.which==3) {
return false;
}
}

function resizePage() {
if (!window.innerWidth) {
window.resizeTo(document.images[0].width+10,document.images[0].height+35);
}
else {
window.innerWidth = document.images[0].width;
window.innerHeight = document.images[0].height;
}
}
</script>
</head>

<body style="margin:0px;" onload="resizePage();">
<script language="javascript" type="text/javascript">

pic = unescape(window.location.search.substr(1));
document.write ('<img name="myimg" src="'+pic+'" border="0" galleryimg="no">');

</script>
</body>
</html>


Comments:

Tested in: IE6, Opera 7, NN4.7, NN7, and Mozilla 1.2.
Works in: IE6, NN7, and Mozilla 1.2.
Doesn't work in: Opera 7, NN4.7

Copyright© 2003, Infinity Web Design