Forum Moderators: open
Did that make any sense? Of course, many people strongly frown on frames, so hopefully someone will come up with an elegant javascript solution for you... then I can use the javascript for my own evil purposes too! ;)
PS... check your StickyMail chihuahuaplanet! (link at the top of the page)
The only thing I wonder about is why chihuahuaplanet picked a nick that is so difficult to spell that you have to copy and paste it. ;)
This page works with JavaScript turned off, doesn't use frames, and works in NetScape 2.0. If you wanted to automatically expand when the mouse moved over the picture, you'd have to have JavaScript.
Click on a thumbnail and generate a pop-up, exactly sized to the enlargement. This is simple javascript, cross browser compatible and one of the HELPFUL uses of a pop-up window.
It allows the original page to still be in view, the window can be moved around by the user, etc. It's a nice gesture to allow the pop-up to have a status bar, so the visitor can tell if the download is hanging.
It's also helpful to make the pop-up page maintain focus until it is closed, so the visitor doesn't unknowingly bury it.
<script>
<!--
function Start(page) {
OpenWin = this.open(page, "CtrlWindow",
"height=*,width=*,toolbar=*,menubar=*,location=*,scrollbars=*,resizable=*");
}
// -->
</script>
--
Use this code for the <a href> tags for the link that opens
the pop-up window:
<a href="javascript:Start('http://YOURFILE.html')">
--
That will allow you to have multiple same-size pop up windows on one page.
If anyone knows of a very simple script for creating pop-ups of different sizes based on the image they're displaying, I'd LOVE to see it!
beginning and advanced JavaScript tutorials [wsabstract.com]
JavaScript Knowledge Base [developer.irt.org] (good FAQs)
Lots of JavaScripts [javascripts.earthweb.com]
Also, here's some code for the bit I suggested about maintaining the pop-up on the top of the page. If you want to do that, in the page that loads into the pop-up window, have your body tag say:
<BODY onBlur="self.focus()">
That keeps the pop-up from getting buried behind a pile of other windows. The issue here is that if the popup window is still open but buried, when someone clicks on a new thumbnail, the page will load into that already open window, but it stays "behind" the main page and the user doesn't see it.
Between head tags:
<script type="text/javascript">
<!--
function displayWindow(url, width, height) {
var Win = window.open(url,"displayWindow",'width=' + width +
',height=' + height + ',resizable=0,scrollbars=yes,menubar=no' );
}
// -->
</script>
Where the link is:
<a href="javascript:displayWindow('http://yourlink.com/page.htm',300,450)">Click Here</a>
============
You will be able to make the pop-up window any size you wish. Multiple sizes on a page.
I don't understand the "var=Win" declaration. Where is this variable used?
The features list has often given me cross-browser and cross-platform trouble when I use "yes" or "no". The most consistent success I've had comes from using "1" or "0", even though this is non-standard.
Also, as an aside, it's important not to accidentally introduce any spaces in the features list area of window.open. Explorer forgives, but Netscpae does not.
However, including any feature at all that is set to "no" or "0" is redundant. If a feature is omitted, then "no" is the default value. Since you are sizing the window exactly, the scrollbars="yes" declaration isn't needed either. So this script can leave the features list alone completely, I believe.
I haven't tested it, but I think the following shorter version would work fine for the HEAD section:
<script type="text/javascript">
<!--
function displayWindow(url, width, height) {window.open(url,"popup",'width=' + width + ',height=' + height);
}
// --></script>
The code for the link in the BODY section would stay as in the original from ihelpyou.
It also might be a good idea to use a different name for the popup window. Since displayWindow is already the name of the function, it keeps everything cleaner to choose a different name for the window itself. That's why I chose "popup".
The code looks like this now:
<script type="text/javascript">
<!--
function displayWindow(url, width, height) { window.open(url,"popup",'width='
+ width + ',height=' + height + ',scrollbars=yes' );
}
// -->
</script>
Thanks much! Works great and leaner now.
<edited>Had a space before scrollbars</edited>