Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Simple page loader script trouble!
Old 01-28-2008, 07:40 PM Simple page loader script trouble!
Junior Talker

Posts: 3
Trades: 0
Hey guys,
First of all I would like to say hello to everybody, this is my first post and first time here, sorry about my english, I'm brazillian.

I'm not an expert at Javascript and those scripts were found in web.

I'm building my webpage and I'm using two scripts to load the pictures before the page shows up.

The first script loads all images in my website.
<body onLoad="waitPreloadPage();">

Quote:
<SCRIPT TYPE="text/javascript" LANGUAGE="javascript">
function waitPreloadPage() {
if (document.getElementById){
document.getElementById('prepage').style.visibilit y='hidden';
}else{
if (document.layers){
document.prepage.visibility = 'hidden';
}
else {
document.all.prepage.style.visibility = 'hidden';
}
}
}
</SCRIPT>
The second script loads the rollover images before they are asked to show up. (Dreamweaver feature)
<body onLoad="MM_preloadImages('images/index2_14.gif','images/index2_15.gif','images/index2_16.gif')">

My problem is that I cannot use both at same time.

I was trying like:
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="waitPreloadPage();" onLoad="MM_preloadImages('images/index2_14.gif','images/index2_15.gif','images/index2_16.gif')">

And the first script is working and the second isn't.
Would it be because I'm using the onLoad="" function two times?
What can I do to make them both work together?
gbrl is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-28-2008, 11:49 PM Re: Simple page loader script trouble!
JeremyMiller's Avatar
WT Moderator

Posts: 1,712
Name: Jeremy Miller
Location: Las Vegas, NV
Trades: 0
Try a wrapper function:

HTML Code:
<script>
function onLoadFunction() {
waitPreloadPage();
MM_preloadImages('images/index2_14.gif','images/index2_15.gif','images/index2_16.gif');
}
</script>
<body onLoad="onLoadFunction();">
__________________
Jeremy Miller

Please login or register to view this content. Registration is FREE
JeremyMiller is offline
Reply With Quote
View Public Profile Visit JeremyMiller's homepage!
 
Old 01-29-2008, 12:33 AM Re: Simple page loader script trouble!
Junior Talker

Posts: 3
Trades: 0
It worked perfectly well!
Thanks man!
gbrl is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Simple page loader script trouble!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12344 seconds with 12 queries