开发者

"'null' is null or not an object" error in IE

开发者 https://www.devze.com 2023-01-16 13:41 出处:网络
Right now I\'m getting this strange error from IE which is basically \'null\' is null or not an object

Right now I'm getting this strange error from IE which is basically

'null' is null or not an object

The line number it gives is completely off so I don't put much credit into that however I think I narrowed it down to where it's coming from.

function openSong(songlink){
     $('#smallbox').slideDown();
     requestCompleteSong('<tr><td>'+songlink+'</td></tr>');
  }

The code above doesn't produce any errors from IE, however when I do an AJAX GET request using jQuery then it seems to throw this error

function openSong(songlink){
     $('#smallbox').slideDown();
     $.get("g开发者_如何学GoetSong.php?fake="+makeid(),{ id: songlink },requestCompleteSong);
  }

'songlink' definitely isn't null because the first function I posted works fine. Here is makeid().

function makeid()
{
  var text = "";
  var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

  for( var i=0; i < 5; i++ )
    text += possible.charAt(Math.floor(Math.random() * possible.length));

  return text;
}

Can anybody see why IE is throwing this error?


This is indeed one of the most generic Internet Explorer JavaScript errors. It means that you are invoking methods of some object which is null. While I cannot tell which part of your code is causing this error I can suggest a way to find it out. You can use the developer tools to debug your code - just put a debugger statement in your code:

function openSong(songlink){
 debugger;
 // rest of the code
}

Then enable debugging from the IE developer toolbar and refresh your page.

0

精彩评论

暂无评论...
验证码 换一张
取 消