PDA

View Full Version : How do I get a Popup window in FrontPage2K


Dave Cotton
05-21-2003, 03:59 PM
Hi List
I'm trying to obtain a JavaScript that will enable me to have a popup window?

This is what I want to do:
Once a visitor clicks on a link (a menu button for instance) a smaller window will popup (in focus) allowing them to fill in their name and address details to receive a catalogue.

The popup window would have to be a scrollable window that I had previously designed with form fields and email to....

I am using FP2K.

Can anyone help please?

Thank you

Dave C

HairyTeeth
05-22-2003, 07:02 AM
I'd rather use NotePad than FrontPage.. :) ..anyway, if you use the forums search facility (enter: 'popup window'), you'll get plenty of answers.

It's always helpful if you post the pertinent code (ie. your popup window form).

Dave Cotton
05-24-2003, 01:40 AM
Hi good buddy
Sorry should have checked search facility first.

However, here is the script I am trying to get to work. Yes its pretty basic and at the moment pretty useless!

Can you advise me on what I have wron please?

Good to speak with yer.

<body
onload="window.open('page.htm','windowname','width=300,height=300,top=10,lef
t=10,screenx=10,screeny=10')">

HairyTeeth
05-24-2003, 10:31 PM
Well aside from the spaces and the line break (this editors fault no doubt), that should work. I wouldn't bother with screenX or screenY. Top and Left should do the positioning without the need for screen(XY).

If you want the popup ro appear from clicked link, I would do this:

<head>
<script type="text/javascript">
<!--;
var formWin = null;
function callPopup(page){
var params="width=300,height=300,top=10,left=10";

if(!formWin || formWin.closed)
formWin=window.open(page,'windowName',params);
else
formWin.focus();
}
//-->
</script>
</head>

...and call it like so:

<a href="yourpage.htm"
onclick="callPopup('yourpage.htm');return false;">
Call Popup</a>


Notice that the onclick event handler passes the url of the page as an argument to the function. This is handy if you have more than one page to load into the popup.

If you only have one page (your form) to load into the popup you can do this instead:

<head>
<script type="text/javascript">
<!--;
var formWin = null;
function callPopup(){
var page="yourpage.htm";
var params="width=300,height=300,top=10,left=10";

if(!formWin || formWin.closed)
formWin=window.open(page,'windowName',params);
else
formWin.focus();
}
//-->
</script>
</head>

...and call it like so:

<a href="yourpage.htm"
onclick="callPopup();return false;">
Call Popup</a>

Notice also that the link has 2 calls to 'yourpage.htm'. If a browser is javascript (or possibly popup) disabled, they can open 'yourpage.htm' without the popup. If they are javascript enabled, they get the popup. The statement 'return false' prevents the normal link from firing but allows the browser to process the onclick event.

See how that goes Dave
:thumbsup:

Dave Cotton
05-26-2003, 10:20 AM
Thanks Hairy Teeth

This looks good I will try. I'm afraid its still a little poke and hope for me...

...Thanks for all the options.

HairyTeeth
05-26-2003, 10:26 AM
lol..hope it helps..if not..just ask. There are better scripters here than me who can answer your question...
:)