- Create Account

onload

Forums > DHTML Scroller > onload
Author
Message

1) Bruno Group: Guests
IP: 84.198.--.--
hi,

I am reworking my website using your scroller www.brunovansina.com
I load a page in the scroller. Then I need the loaded page to do things on the mother page (index.htm) using ONLOAD:

1) I need to load a banner "banner_bruno.htm" in a iFrame called 'banner' in the mother page
2) I need it to trigger other javascript (not so urgent)

I can load the banner from a mouseover="parent.banner.location.href='banner_bruno.htm' "in the loaded page but then it loads the banner everhy time you move your mouse over the scroller. I need to load it only once like onload! onload in the body tag of the loade page does not seem to do anything to my mother page. mouseovers in the content of the loaded page do work so there must be a way?

Any sugestion?? thanx a lot!

2) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 203.118.--.--
This script is kind of outdated now, if you're not too far into your redesign try using HTMLHttpRequest instead!

Otherwise, if you want to hook onload events, try putting something in the scroller's ONLOAD event handler right where you see the loading message being hidden.

- Angus.

3) Bruno vansina Group: Guests
IP: 84.198.--.--
i prefer the scroller becouse the scrollerbar fits my design! I should work with Flash .... I never got into it!

I am calling pages in the scroller like this:

<a id="bruno" href="upcoming.htm" target="content" onClick="parent.banner.location.href='banner_bruno.htm';toggleBox('bruno_ img',1);toggleBox('vvg_img',0);toggleBox('double_img',0);">Bruno V ansina</a>

but i whant in the loaded page:

<body onLoad="parent.banner.location.href='banner_bruno.htm';toggleBox('bruno_ img',1);toggleBox('vvg_img',0);toggleBox('double_img',0);">

So events happen when page is loaded in the scroller! and not when link is clicked. It only works when I put it somwhere in the loaded page as a MousOver for ex., onLoad seems inactive...

rewriting the script seems verry complicated because different pages call different banners!

What I understand is the onload function is in use by the script? thats why I can not put onloads????? is there a way to go around it??

4) Angus Turnbull Group: Moderators
Posts: 4042 Joined: 7 Dec 2003 Location: New Zealand IP: 203.118.--.--
As I posted above you can hook the scroller's own internal ONLOAD event that fires whenever a file loads. Just beneath where you set its position in the page replace the onload line with this:

onload = function()
{
 var lm = getSty('loadMessage'); if (lm) lm.visibility = 'hidden';
 alert('File has loaded: ' + this.loadedFile);
};

Add in your own code there as necessary! Putting scripts in the loaded files themselves is a little messy due to the differing loading mechanisms used by the script.

- Angus.

5) Bruno Vansina Group: Guests
IP: 84.198.--.--
Hi,

Tryed it and it works! But needed different onloads depending the pages .... worked around it!

I've put in my pagees (that load in the scroller) <iframe src="fix_bruno.htm" width="1px" height="1px" scrolling="no" frameborder="no" style="visibility:hidden; "></iframe>

then  in the iframe a page (this example fix_bruno.htm with <body onLoad="parent.banner.location.href= 'banner_bruno.htm';parent.toggleBox('bruno_img',1);parent.toggle Box('vvg_img',0);parent.toggleBox('double_img',0);" >

... this  works! Now I trigger the banner and background image on page load! Its a bit slower due to loading ... its not so charming coding but it does the trick!

check out www.brunovansina.com !



Post a Reply:

You are not logged in, and will be posting anonymously as a guest. If you want to post using an account, please login at the top of this page.