HighDots Forums  

Multiple onloads won't work

alt.html.tags alt.html.tags


Discuss Multiple onloads won't work in the alt.html.tags forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Terri
 
Posts: n/a

Default Multiple onloads won't work - 09-23-2003 , 11:04 PM






I've read lots of posts about how to use multiple body onloads, but I
can't get it to work at all. I have a pop-up window that pops up
after about 20 seconds, but I also want an x-it pop window to popup
when they leave the site. I tried putting the semi-colon in several
different places, but the examples I find are all much more simple and
shorter. Can anyone please help? I would be so grateful.
Here's the 2 scripts I have within the <head> tags.

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
function popupPage() {
var page = "popup.html";
windowprops = "height=200,width=400,location=no,"
+ "scrollbars=yes,menubars=no,toolbars=no,resizable= yes";

window.open(page, "Popup", windowprops);
}
// End -->
</script>
_______________________________________________
<script language="JavaScript">
<!-- begin x-it code
var exit=true;
function xit() {
if (exit)
window.open('popup.htm','','toolbar=no,menubar=no, scrollbars=yes,resizable=yes,location=no,height=17 5,width=200');
}
// end x-it code -->
</script>
________________________________________________

Here's the 2 onloads

<body onLoad="setTimeout('popupPage()', 7000);" bgcolor="#FFFFFF"
LEFTMARGIN="0" RIGHTMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0"
TOPMARGIN="10" link="#cc0000" vlink="#dd3333">

<body onunload="xit()" bgcolor="#ffffff" text="#000000" leftmargin="0"
topmargin="0" marginwidth="0" marginheight="0" link="#000099"
vlink="#006633" alink="#006633">

How do I combine the 2 onloads?

Thanks,

Terri
www.thinkandreachpar.com

Reply With Quote
  #2  
Old   
Tim Booth
 
Posts: n/a

Default Re: Multiple onloads won't work - 09-24-2003 , 06:18 PM








Terri wrote:
Quote:
I've read lots of posts about how to use multiple body onloads, but I
can't get it to work at all. I have a pop-up window that pops up
after about 20 seconds, but I also want an x-it pop window to popup
when they leave the site.
Well, my first suggestion - *please* don't do this. Any site that
magically creates pop-ups without warning immediately loses a
lot of credibility points, and tends to end up with lower traffic
than might otherwise be the case. If a user wants to leave your
site becuase of a link you have placed there, then let them go...

Quote:
Here's the 2 onloads

body onLoad="setTimeout('popupPage()', 7000);" bgcolor="#FFFFFF"
LEFTMARGIN="0" RIGHTMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0"
TOPMARGIN="10" link="#cc0000" vlink="#dd3333"

body onunload="xit()" bgcolor="#ffffff" text="#000000" leftmargin="0"
topmargin="0" marginwidth="0" marginheight="0" link="#000099"
vlink="#006633" alink="#006633"
On the same page?? Well, the would be 2 <body> tags, which is not
correct HTML...

Webko


Reply With Quote
  #3  
Old   
Terri
 
Posts: n/a

Default Re: Multiple onloads won't work - 09-24-2003 , 10:22 PM



I know you can't have two body tags. There's some way to combine both
actions with the one body tag, by using a semi-colon in between the 2
call for actions, but I can't figure out exactly where to combine
these 2.
Thanks,
Terri


Tim Booth <tbooth (AT) usyd (DOT) edu.au> wrote

Quote:
Terri wrote:

I've read lots of posts about how to use multiple body onloads, but I
can't get it to work at all. I have a pop-up window that pops up
after about 20 seconds, but I also want an x-it pop window to popup
when they leave the site.

Well, my first suggestion - *please* don't do this. Any site that
magically creates pop-ups without warning immediately loses a
lot of credibility points, and tends to end up with lower traffic
than might otherwise be the case. If a user wants to leave your
site becuase of a link you have placed there, then let them go...


Here's the 2 onloads

body onLoad="setTimeout('popupPage()', 7000);" bgcolor="#FFFFFF"
LEFTMARGIN="0" RIGHTMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0"
TOPMARGIN="10" link="#cc0000" vlink="#dd3333"

body onunload="xit()" bgcolor="#ffffff" text="#000000" leftmargin="0"
topmargin="0" marginwidth="0" marginheight="0" link="#000099"
vlink="#006633" alink="#006633"

On the same page?? Well, the would be 2 <body> tags, which is not
correct HTML...

Webko

Reply With Quote
  #4  
Old   
Tim Booth
 
Posts: n/a

Default Re: Multiple onloads won't work - 09-24-2003 , 10:47 PM





Terri wrote:
Quote:
I know you can't have two body tags. There's some way to combine both
actions with the one body tag, by using a semi-colon in between the 2
call for actions, but I can't figure out exactly where to combine
these 2.
Given they're actually doing different things, then won't:

<body onLoad="setTimeout('popupPage()', 7000);" onunload="xit()"
bgcolor="#ffffff" text="#000000"
leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
link="#000099" vlink="#006633" alink="#006633">

do the trick?

Webko


Reply With Quote
  #5  
Old   
webgeo99
 
Posts: n/a

Default Re: Multiple onloads won't work - 11-03-2003 , 02:22 PM




"Terri" <Terri (AT) thinkandreachpar (DOT) com> wrote

Quote:
I've read lots of posts about how to use multiple body onloads, but I
can't get it to work at all. I have a pop-up window that pops up
after about 20 seconds, but I also want an x-it pop window to popup
when they leave the site. I tried putting the semi-colon in several
different places, but the examples I find are all much more simple and
shorter. Can anyone please help? I would be so grateful.
Here's the 2 scripts I have within the <head> tags.

SCRIPT LANGUAGE="JavaScript"

!-- Begin
function popupPage() {
var page = "popup.html";
windowprops = "height=200,width=400,location=no,"
+ "scrollbars=yes,menubars=no,toolbars=no,resizable= yes";

window.open(page, "Popup", windowprops);
}
// End --
/script
_______________________________________________
script language="JavaScript"
!-- begin x-it code
var exit=true;
function xit() {
if (exit)

window.open('popup.htm','','toolbar=no,menubar=no, scrollbars=yes,resizable=y
es,location=no,height=175,width=200');
Quote:
}
// end x-it code --
/script
________________________________________________

Here's the 2 onloads

body onLoad="setTimeout('popupPage()', 7000);" bgcolor="#FFFFFF"
LEFTMARGIN="0" RIGHTMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0"
TOPMARGIN="10" link="#cc0000" vlink="#dd3333"

body onunload="xit()" bgcolor="#ffffff" text="#000000" leftmargin="0"
topmargin="0" marginwidth="0" marginheight="0" link="#000099"
vlink="#006633" alink="#006633"

How do I combine the 2 onloads?

Thanks,

Terri
www.thinkandreachpar.com

what your looking for is the OnClose Event to fire when the browser closes.
Just change your code to reflect the Event you want to fire.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.