Jump to content

Javascript Image Pre-Loader


McBryver

Recommended Posts

Ok all sites on google says this should work but it dosnt.

 

Javascript:

<head>
<script type="text/javascript">
function preloader() 

{
fresh = new Image(960,720)
fresh.src = "http://x-tremeclean.com/images/fresh.png"
}
</script>

</head>
<body id="top" onLoad="javascript:preloader()">

Image Code:

      <div class="floater">
        <h2>1. This carpet is the after picture of what we have done.</h2>
        <p>This is what we accomplish using our RX-20 Cleaning Device.</p>
      </div>
      <p class="readmore"><a href="#">Schedual Quote »</a></p>
      <img src="images/fresh.png" id="fresh" name="fresh" alt="" /> </div>

 

Any help would be cool.

McBryver

Link to comment
Share on other sites

That is because you are calling the function on page load,after everything else has loaded.

 

Try this...

<script type="text/javascript">
<!--
fresh = new Image(960,720)
fresh.src = "http://x-tremeclean.com/images/fresh.png"
//-->
</script>

 

Instead of...

<script type="text/javascript">
function preloader()

{
fresh = new Image(960,720)
fresh.src = "http://x-tremeclean.com/images/fresh.png"
}
</script>

 

Regards, Paul.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.