My webpage contains thumbnail images that when moused-over, cause a larger image on the same page to change. In addition, the large image when clicked, causes a javascript window to open with an even larger image displayed based on a url parameter that is passed.
All works perfect EXCEPT that if the thumbnail image code is not utilized (no thumbnail is moused-over yet) the url parameter is passed as undefined.
In terms of the following code, the currentImage variable remains undefined unless the thumbnail portion of the javascript code is utilized.
How is this corrected?
HEAD SECTION JAVASCRIPT CODE:
Thumbnail image code:
Larger image code:
All works perfect EXCEPT that if the thumbnail image code is not utilized (no thumbnail is moused-over yet) the url parameter is passed as undefined.
In terms of the following code, the currentImage variable remains undefined unless the thumbnail portion of the javascript code is utilized.
How is this corrected?
HEAD SECTION JAVASCRIPT CODE:
Code:
var currentImage;
function showBigImage( isource,bigImage,header ) {
var theImage = document.getElementById( 'largeimage' );
theImage.src = isource;
currentImage = bigImage;
document.getElementById('photoHeader').innerHTML=header;
document.getElementById( 'largeimage' ).alt=header;
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open('/large_image.asp?url_image=' + currentImage,winName,features);
Thumbnail image code:
Code:
<a href= "javascript:;" class="small_img" >
<td height=36 valign="middle" class="small_img" onmouseover="showBigImage( 'imagescript.asp?path=<%= images("url_img") %>&width=250','<%= images("url_img") %>','<%= images("alt_img") %>' )">
<img src="imagescript.asp?path=<%= images("url_img") %>&width=36" border="0" > </td>
</a>
Larger image code:
Code:
<a href="javascript:;" onclick="MM_openBrWindow('/large_image.asp?url_image=<%Response.Write(images("url_img"))%>','imagewindow','width=600,height=600')"><img src="imagescript.asp?path=<%=images("url_img")%>&width=250" name="largeimage" id"largeimage" border="0" alt="" ></a>