View Full Version : custom popup window on load


Onyx
07-03-2003, 01:33 AM
How do you make your own popup window on page load? What I mean is doing this:


<input type="button" Value="yournamehere" style="font-family:yourfontname" style="background:#yourcolorcode" ONCLICK="window.open('yoururlhere.html', 'Sample', 'toolbar=no,location=no,directories=no,status=no,m enubar=no,scrollbars=no,resizable=no,copyhistory=y es,width=500,height=500')">


ONLY I DONT WANT THE INPUT BUTTON, I WANT IT TO COME UP ON PAGE LOAD!

In my case, I'm trying to make it so a window can pop up saying you've got a new message, but I don't want to have to push a button for it to come up, like the above example. It should come up on page load!

Thanks

- Onyx

burningstars
07-03-2003, 02:46 AM
I believe this is the javascript for it!


<!-- STEP ONE: Copy this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Idea by: Nic Wolfe (Nic@TimelapseProductions.com) -->
<!-- Web URL: http://fineline.xs.mw -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,statusbar=1,men ubar=1,resizable=1,width=400,height=500,left = 312,top = 134');");
}
// End -->
</script>


<!-- STEP TWO: Paste this onLoad event handler into the BODY tag -->

<BODY onLoad="javascript:popUp('YOURURLHERE.HTML')">





^you can change the widths and stuff to your liking i just picked everything so you would have the options there for you already! Hope it works!

Onyx
07-03-2003, 03:02 AM
Hey thanks I'll try that :D

-Onyx

Onyx
07-08-2003, 01:18 AM
Nope didn't work pal. I want to do what it says in Java 4 (http://www.lissaexplains.com/java4.shtml"), but not having the window come up when you click the input button.

I basically want to combine this code:


Alert upon entering page:

<SCRIPT language="JavaScript">alert("your message here")</SCRIPT>


which brings up a popup on page load (but just an IE alert)


With this one:


<input type="button" Value="yournamehere" style="font-family:yourfontname" style="background:#yourcolorcode" ONCLICK="window.open('yoururlhere.html', 'Sample', 'toolbar=no,location=no,directories=no,status=no,m enubar=no,scrollbars=no,resizable=no,copyhistory=y es,width=500,height=500')">


which brings up a popup window that I want to use, only it comes up when you click a button. I want it to come up upon entering page.



Just thought I'd explain it a little deeper. ;-)


- Onyx

gonron
07-15-2003, 09:06 PM
do you just want a popup window to load when the page loads?

add this to the between the <head> and </head> tags:

<script language="JavaScript>
<!--
function MM_openBrWindow(theURL, winName, features) { //v2.0
window.open(theURL, winName, features);
}
//-->
</script>

in the <body ...> line, add"

onLoad="MM_openBrWindow('http://www.yoururl.com','windowname','width=00,height=80' )"


i.e.
<body bgcolor="#FFFFFF" text="#000000" onload="MM_openBrWindow('includes/remote.htm','remote','width=180,height=500')">

not really hard IF that is what you wanted

Onyx
07-16-2003, 12:53 AM
Well, will that bring up a window that's not a Microsoft IE Explorer Alert with an OK button, or an actual browser window without the address bar, tool bar, location all that? Just the title bar?

-Onyx

gonron
07-16-2003, 01:41 AM
here you can see it...

http://www.gonron.com/example/

popup blockers will stop it from popping up ;)

(couldn't figure out why this machine wouldn't do it)

Onyx
07-21-2003, 05:00 AM
Hey, that works thanks a lot man! :D

-Onyx | problem solved :P