Javascript Popup Info Box

He has: 34 posts

Joined: Nov 2003

First off, this is my first time with Javascripting. I'm currently reading the JavaScript Bible, which has helped out tremendously, but my main goal for Java still seems unreachable.

I want to make a "Click for More Information" link simply open a preset sized windows popup with the requested information in it, and a simple "Close" link. There are so very many sites that use this feature, yet I am evidently lost in trying to implement this on my test site.

If anyone could lend a few keystrokes, I would appreciate it greatly! Thanks!

Brad Arnold

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

For a great window opener I recommend you this site.

For the close link you just have to place a link in the document like this one:
Close Window

('javascript' without underscores)

Hope this helps,

Shakespeare: onclick || !(onclick)

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

Lunch[box wrote: ']First off, this is my first time with Javascripting. I'm currently reading the JavaScript Bible, which has helped out tremendously, but my main goal for Java still seems unreachable.

First off, understand that Java is different from JavaScript

For closing the window:
Close Window

For opening a new window: (I think)
<script type="text/javascript">
window.open("width=200, height=200");
</script>

Or if you want to use it many times:
<script type="text/javascript">
function fnopenwindow(winHeight, winWidth)
{
window.open("width=200, height=200");
}
</script>

Close Window

Not tested, but the close window one should work Smiling

Jack Michaelson's picture

He has: 1,733 posts

Joined: Dec 1999

@ Renegade:
The url-param is missing in your fnopenwindow.

Like this:
function fnopenwindow(ThePage, winHeight, winWidth){
window.open(ThePage, "width=200, height=200");
}

and:
Open window

And there are more params (see the link in my previous post) Smiling

Shakespeare: onclick || !(onclick)

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

A prefab script for opening the window: zerocattle.com/examples/popUp.html

Inside the window, you have an .html page with your information and somewhere on it make yourself a link or a button image, however you wish, and use the window.close(); scripting provided by the others in this thread.

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

...you beat me to in posting Jack, didn't see it till now Sticking out tongue

BTW, thanks also for fixing my code Smiling

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.