AAKALAN
10-01-2006, 03:55 AM
I've put in a very long day getting this custom code to work - you click on a thumbnail and the script opens a new window, sizes it for the larger image, sets the SRC, width and height attributes for an img object.
This code works just fine across my LAN:
<SCRIPT LANGUAGE="JAVASCRIPT">
function bigImg(cImagePath, nWidth, nHeight, cFileName) {
nWHeight = nHeight+100;
nWWidth = nWidth+100;
nTop = window.screenTop-70;
nLeft = window.screenLeft+350;
cParams = "height= "+nWHeight+",width= "+nWWidth+",status=no,toolbar=no,menubar=no,location=no,top="+nTop+",left="+nLeft;
w = window.open("PicturePage.htm",null,cParams);
w.document.testImage.src = cImagePath;
w.document.testImage.height = nHeight;
w.document.testImage.width = nWidth;
w.document.title = 'Photo by: A. A. Katz: '+ cFileName+' ';
}
</SCRIPT>
Each thumbnail calls this function, passing its own relative URL and the image sizes.
<A HREF="javascript:bigImg('Fullsize/DSC_9281.jpg',640,430,'DSC_9281')">
The problem: This works perfectly on my machine across the LAN. Really beautiful, in fact, exactly what I want.
But it doesn't work over the Web.
1) I always get the window/page
2) Sometimes I get the image, too
3) But most of the time, I get the Javascript error:
testImage is null or not an object!
Only rarely, I get:
document is null or not an object!
Could it be that I'm losing the new window's object reference somehow?
Or perhaps some kind of timing thing (the rest of the code firing before the form is loaded? The form is about 6 lines of code. The operative line in the page that gets loaded in the new window is:
<img src="#" name="testImage" width="10" height="10" id="testImage">
I've been writing this kind of code (and tools to write it) since 1995. And I am completely and totall stumped. Someone please help. Just point me in a direction! I'm out of options.
You can see the page at http://www.aakatz.com/photo/cutler/homepage.htm
Thanks in advance[/SIZE]
This code works just fine across my LAN:
<SCRIPT LANGUAGE="JAVASCRIPT">
function bigImg(cImagePath, nWidth, nHeight, cFileName) {
nWHeight = nHeight+100;
nWWidth = nWidth+100;
nTop = window.screenTop-70;
nLeft = window.screenLeft+350;
cParams = "height= "+nWHeight+",width= "+nWWidth+",status=no,toolbar=no,menubar=no,location=no,top="+nTop+",left="+nLeft;
w = window.open("PicturePage.htm",null,cParams);
w.document.testImage.src = cImagePath;
w.document.testImage.height = nHeight;
w.document.testImage.width = nWidth;
w.document.title = 'Photo by: A. A. Katz: '+ cFileName+' ';
}
</SCRIPT>
Each thumbnail calls this function, passing its own relative URL and the image sizes.
<A HREF="javascript:bigImg('Fullsize/DSC_9281.jpg',640,430,'DSC_9281')">
The problem: This works perfectly on my machine across the LAN. Really beautiful, in fact, exactly what I want.
But it doesn't work over the Web.
1) I always get the window/page
2) Sometimes I get the image, too
3) But most of the time, I get the Javascript error:
testImage is null or not an object!
Only rarely, I get:
document is null or not an object!
Could it be that I'm losing the new window's object reference somehow?
Or perhaps some kind of timing thing (the rest of the code firing before the form is loaded? The form is about 6 lines of code. The operative line in the page that gets loaded in the new window is:
<img src="#" name="testImage" width="10" height="10" id="testImage">
I've been writing this kind of code (and tools to write it) since 1995. And I am completely and totall stumped. Someone please help. Just point me in a direction! I'm out of options.
You can see the page at http://www.aakatz.com/photo/cutler/homepage.htm
Thanks in advance[/SIZE]