
August 5th, 2003
03:41 PM
'puter thangy newbie...hehe
Status: Offline!
popup window
argggg...maybe one of you js gurus can help me out here...
i'm having trouble with the code for a pop up window.
I want to be able to click on the link or image and have a small window pop up.
also can anyone recommend a good js book. i hate to have to keep asking you all when i need help with js. you're all so nice and always help me out. thanks so much.
mm

August 5th, 2003
03:52 PM

You just need to use the open method, and in the third argument of it you define the height/width and other window properties. So for something like this you just need to define height,width, and scrollbars since by default they aren't there when you open a new window.
For a basic text link.
<a href = "#" onclick = "window.open('file.html', '', 'height=200,width=300,scrollbars=1');">Open a 300x200 window.</a>
Then for an image - Basically the same thing only adding an <img> element to include the image.
<a href = "#" onclick = "window.open('file.html', '', 'height=200,width=300,scrollbars=1');"><img src = "image.gif" border = "0" alt = "" /></a>
And, about the JavaScript book, I'd suggest getting any of these three (I own all of them):
The Book of JavaScript: A Practical Guide to Interactive Web Pages (Dave Thau)
Sams Teach Yourself JavaScript in 24 Hours (Michael Moncur)
JavaScript: The Definitive Guide (David Flanagan)
I'd suggest getting one of the first two since the third is slightly more advanced, but extremely helpful and a great reference, has to be my favorite book on JavaScript so far.
Well - Good luck!
___________________


August 7th, 2003
02:03 PM
Hey MilkMaid.
This code is is easy and generates a popup window easily. I including some notes to help ya out.
<script language="javascript">
<!--
function popup(u, s, w, h) {
window.open(u, "", "width=" + w + ", height=" + h + ", scrollbars=" + s + ")
}
-->
</script>
Here is how to open your popup with a basic link:
<a href="javascript: popup('URL', 'SCROLLBARS? YES OR NO?', width, height);">Click to open!</a>
Here is how to open your popup with an image link:
<a href="javascript: popup('URL', 'SCROLLBARS? YES OR NO?', width, height);"><img src="IMAGE SOURCE" border="0"></a>
And here is the code to close your popup:
<a href="javascript: close();">Close Me</a>
I hope this helped! 
Terry
___________________
http://www.zerolasek.net