jamescover
09-29-2002, 01:24 AM
Hi:
In the script below, I always assumed that I could lauch each link in a new window by changing the window name. I guess I neglected to sufficiently test this, because it doesn't work. That means that my script will launch every image in the same window. So, if the images are different sizes, it defeats the purpose of the script :rolleyes: Not good.
<script>
<!--
/*
God so loved the world that he gave his only begotten son,
so that whosoever believed in him would not perish,
but have everlasting life.
*/
function newWin(picName,winName,w,h,top,left,size){
largePic=window.open('','winName','width='+w+',height='+h+',top='+((screen.height-h)/2)+',left='+((screen.width-w)/2));
largePic.document.open();
largePic.document.write('<html><head><title>largePic<\/title><\/head><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="self.focus()"><img src="'+picName+'" border="0" width="'+w+'" height="'+h+'" alt="'+picName+'"><\/body><\/html>');
largePic.document.close();
}
//-->
</script>
inline handler:
<a href="javascript:newWin('nameOfLargePic.gif','myWin','300','300','top','left');void(0);"><img src="nameOfThumbnail.gif" width="50" height="50" alt="nameOfThumbnail.gif" border="0"></a>
I can handle it when just opening a window, but I'm writing to it at the same time.
Umm, when using variable=window.open(), how can you change the window name, so that you can open a new window from each hyperlink? :confused: I'm talking 'bout a reusable function here.
Any help will be appreciated.
James
He is risen!!!
In the script below, I always assumed that I could lauch each link in a new window by changing the window name. I guess I neglected to sufficiently test this, because it doesn't work. That means that my script will launch every image in the same window. So, if the images are different sizes, it defeats the purpose of the script :rolleyes: Not good.
<script>
<!--
/*
God so loved the world that he gave his only begotten son,
so that whosoever believed in him would not perish,
but have everlasting life.
*/
function newWin(picName,winName,w,h,top,left,size){
largePic=window.open('','winName','width='+w+',height='+h+',top='+((screen.height-h)/2)+',left='+((screen.width-w)/2));
largePic.document.open();
largePic.document.write('<html><head><title>largePic<\/title><\/head><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onload="self.focus()"><img src="'+picName+'" border="0" width="'+w+'" height="'+h+'" alt="'+picName+'"><\/body><\/html>');
largePic.document.close();
}
//-->
</script>
inline handler:
<a href="javascript:newWin('nameOfLargePic.gif','myWin','300','300','top','left');void(0);"><img src="nameOfThumbnail.gif" width="50" height="50" alt="nameOfThumbnail.gif" border="0"></a>
I can handle it when just opening a window, but I'm writing to it at the same time.
Umm, when using variable=window.open(), how can you change the window name, so that you can open a new window from each hyperlink? :confused: I'm talking 'bout a reusable function here.
Any help will be appreciated.
James
He is risen!!!