javascript - "'null' is null or not an object" error in IE - Stack Overflow

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

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 pletely off so I don't put much credit into that however I think I narrowed it down to where it's ing 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("getSong.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?

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 pletely off so I don't put much credit into that however I think I narrowed it down to where it's ing 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("getSong.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?

Share Improve this question asked Sep 19, 2010 at 4:33 AlbinoswordfishAlbinoswordfish 1,9577 gold badges34 silver badges51 bronze badges 2
  • 1 FYI, how IE calculates line numbers is like this: concatenate all javascript files/code in the order they appear in the HTML page into a single large file, then count the line number. – slebetman Commented Sep 19, 2010 at 4:39
  • Also, IE developer toolbar would show the erroneous code at the line number from IE. – Hari Pachuveetil Commented Sep 19, 2010 at 5:10
Add a ment  | 

1 Answer 1

Reset to default 4

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744290432a4567004.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信