View Single Post
  #1 (permalink)  
Old 01-09-09, 07:41 AM
d-base d-base is offline
New Member
 
Join Date: Jan 2008
Location: Sofia
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Question [SOLVED] HALP :) javascript error on site.

Hai guys

I'd greatly appreciate some help with this problem.

There's a script on my website for image replacement, it works fine but Internet Explorer returns an error that says
" 'src' is null or not an object "

Here's the script.

Any clues what's wrong with it? (once again, it works perfectly, just returns this error)
Code:
<script type="text/javascript"><!--

function pi ()
{
  var plaatjes = document.images;
  var aantal = plaatjes.length;
  
  for(i=0;i<=aantal;i++)
  {
   
    var plaatje = plaatjes[i];
    if(plaatje.src == "http://to old  image.gif")
    {
      plaatje.src = "http://to new image.gif";
    }
  }
}
//--></script>

<script type="text/javascript"><!--
window.onload = pi();
//--></script>
Gives the error at the line in red.

In Firefox's error console it says "plaatje is undefined"
The image urls are correct and the script as I said works, it replaces the images but I dunno why it returns this error.

Last edited by Nico; 01-09-09 at 08:57 AM. Reason: [code] Wrappers.
Reply With Quote