Null is null or not an object

HI guys,

I am only getting this error with IE7 and I am aware of the fact that it means that certain DOM elements may not be defined.

This doesn’t surprise me as I know that there are lots of things happening, have tried all sorts of things, definitely not a syntax issue as I have run it thru jslint and it is valid. I have moved all of the scripts to the bottom of the <body> still no difference. I am testing using IE7 in a virtual box. maybe its the performance overheads of that or maybe IE 7 is just so crap at running scripts that it isnt capable of such an ambitous AJAX load- dependent script.

What do you think?

www.will.site88.net/jake/video.php

I don’t click posted links for obvious security reasons. Which line(s) in your code is giving the error? and post the actual error message in its entirety.

I don’t have any problems running AJAX requests with IE7, so the problem is most likely at your end.

IE7 has no issues running heavy Ajax loads. Must be your script. And like the poster above said, you should post the code in question or some permutation of it so we can get an idea of what is going on.

Ok, thankyou for trying to help. The code is below. I am adding two different Flash objects dynamically to the page, two different button responses, the first of which adds flowplayer and the error for that is:

getClip().fullduration is null or not an object

  • this one I am aware of - it is because I am trying to get the duration of a clip from flowplayer which doesn’t quite have it until the video starts playing. However, this runs fine on all the browsers, its a shortcoming of the flowplayer api, no other way to do it so I just need a way to hide the error in IE7. Any ideas?

Anyway, the other errors occur when I do the YouTube load -loads a chromeless yt player, haven’t got a clue why its happening, the errors for that are :

Message: ‘null’ is null or not an object
Line: 1
Char: 158
Code: 0
URI: http://will.site88.net/jake/video.php

Message: ‘null’ is null or not an object
Line: 1
Char: 158
Code: 0
URI: http://will.site88.net/jake/video.php

Message: Unspecified error.
Line: 49
Char: 5
Code: 0
URI: http://will.site88.net/jake/video.php


$(document).ready(function() {
///////////////////Setup FROM THE TOP DOWN ! ///////////////////////////////////
			
          	$( "#progress_bar" ).slider({disabled: true});
			$("#flowplayer_mute, #YouTube_mute").hide();
 
			
/////////////// PLAYER CHROME (player controls)////////////	
 
		$("#YouTube_fullscreen_effect, #flowplayer_fullscreen_effect").live({
        mouseenter:
			   function()
			   {
			 $("#fullscreen_hover").animate({width:"24",height:"18"}, "5000");
				// event.stopPropagation();
			   },
			mouseleave:
			   function()
			   {
			 $("#fullscreen_hover").animate({width:"15",height:"11"}, "10000");
			//	 event.stopPropagation();
              }
    	   }
	    );
 
		
				$("#flowplayer_vol_btn, #YouTube_vol_btn, #YouTube_volume, #flowplayer_volume").live({
        mouseenter:
			   function()
			   {
		   $("#YouTube_volume, #flowplayer_volume").stop().show().animate({"opacity": "1"}, "slow");
 
			   },
			mouseleave:
			   function()
			   {
				$("#YouTube_volume, #flowplayer_volume").stop().animate({"opacity": "0"}, 2900);
 
              }
    	   }
	    );
		
///////////////////MISC HOVER//////////////////////////////////
 
 
 
         $(".play").hover(
		 function()
			 {
			 $(this).animate({width:"97",height:"65"}, "fast");
			//	     event.stopPropagation();
			 },
			 function()
			 {
			 $(this).animate({width:"87",height:"55"}, "fast");
			 //	     event.stopPropagation();
			 }
		);
		
		
		$(".flowplayer_select, .flowplayer_btn, .YouTube_select, .YouTube_btn").hover(
		 function()
			 {
			  var src ="Images/btn_green.png";
			  if($(this).attr("class") == "flowplayer_btn" || $(this).attr("class") == "flowplayer_select")
			  {
	          $(".flowplayer_btn").attr("src", src).animate({width:"35",height:"35"}, "fast");
			  }
			  else
			  {
		      $(".YouTube_btn").attr("src", src).animate({width:"35",height:"35"}, "fast");
			  }
			 },
			 function()
			 {
			  var blue ="Images/btn_blue.png";
			  var red ="Images/btn_red.png";
	          $(".flowplayer_btn").attr("src", blue).animate({width:"31",height:"31"}, "fast");
		  $(".YouTube_btn").attr("src", red).animate({width:"31",height:"31"}, "fast");
			 }
		);
 
 
		
////////////////////////PANEL PLAYER-SELECTION POPOUT///////////////////
		$(".flowplayer_select, .flowplayer_btn").click(function(){
		$(".panel_left").show("2000");
	    // event.stopPropagation();
		 $.scrollTo($(".panel_left"), 1000);
	    });
		
 
 
		 $(".YouTube_select, .YouTube_btn").click(function(){
	     $(".panel_right").show("slow");
		//event.stopPropagation();
        $.scrollTo($(".panel_right"), 1000);
	    });
		
		$(".upload_panel_close").click(function(){
		$(".panel_left, .panel_right").hide("slow");
			//$('form').clearForm();	
		return false;
	    });
		$("#accordion").accordion({ autoHeight: false });
		
		 $("input[type=file]").filestyle({ 
			 image: "Images/browse.png",
			 imageheight : 38,
			 imagewidth : 92,
			 width : 250
		 });
		 
		 
 
});  


Sorry this is the main code I had moved it to the bottom of the body to try and see if it made a difference. The stuff above may still be relevant but its mainly just rollovers:


$(document).ready(function() {
///////////////////Setup FROM THE TOP DOWN ! ///////////////////////////////////
			
          	$( "#progress_bar" ).slider({disabled: true});
			$("#flowplayer_mute, #YouTube_mute").hide();
			$(".play").click(function() {    // when the user clicks play on any of the accordion entires
				$item = $(this).parent().attr("class");
                var $player = $f();

				if($item == "YouTube_identify")
				{
	               $("#splash").remove();
		           if(  $("#splash"))
				   {
				   $('<a id="splash"><div id ="ytapiplayer"><p id="no_flash">You must have at least Flash Player 8 installed to view YouTube videos</p></div></a>').prependTo('#content');		              		}			
			       var params = { allowScriptAccess: "always" };
				   var atts = { id: "myytplayer" };
				   swfobject.embedSWF(
				   "http://www.youtube.com/apiplayer?enablejsapi=1&version=3&playerapiid=ytplayer" ,
				  "ytapiplayer", "414", "245", "8", null , null , params, atts);
				    change_id("YouTube");
				   $("#chrome img, #progress_bar").css({opacity:1}, "5000");	
				   $.scrollTo("#header", "fast");
				}
				else
				{
					/////////// get embed code from db (stored in accordion table)////////
					if($(this).parent().find(":input"))
					{
					 $embed_code = $(this).parent().find(":input").attr("value");
					// alert($embed_code);
					}  
					/////////// put video hyperlink ready for player////////
				   $("#splash").attr('href' , "http://blip.tv/file/get/N8inpasadena-Flowers457.flv"); 
				  ///////////call flowplayer flash application //////////////
				 // flowplayer("player", {src: "http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf", wmode: "opaque"})
				   $f("splash",{src: 'http://releases.flowplayer.org/swf/flowplayer-3.2.7.swf', wmode: 'transparent'},  { 
						// use a "sky blue" background on the player canvas	
					//	canvas: {backgroundColor:'#000000', backgroundGradient: 'high', bottom:0},
						// use a minimalistic controlbar
						plugins:  {					
							controls:{all:false, fullscreen:true, autoBuffering: true}
						},   ///////////Callback function/////////
						wmode: "opaque", 
						onLoad: function () {
							this.unmute();
							$("#flowplayer_mute").hide();
							interval_id = setInterval('get_time()',1000);
						},
                        onPause: function() {
							var src="Images/play.png";
							clearInterval(interval_id);
							$("#flowplayer_pause").attr("src", src).removeAttr( "id" ).attr("id", "flowplayer_play"); 
						},
						onStop: function() {
							var src="Images/play.png";
						    this.getPlugin("play").hide();
							clearInterval(interval_id);
							$("#flowplayer_pause").attr("src", src).removeAttr( "id" ).attr("id", "flowplayer_play"); 
							$("#flowplayer_progress_bar" ).slider( "option", "value", 0 );
						},
						onResume: function() {
							var src="Images/pause.png";
							$("#flowplayer_play").attr("src", src).removeAttr( "id" ).attr("id", "flowplayer_pause"); 
							interval_id = setInterval('get_time()',1000);
						},
						onFinish: function() {						
							 clearInterval(interval_id);
							 flowplayer_stop();
						}	,
					    onBegin: function(){
								var src="Images/pause.png";
							$("#flowplayer_play").attr("src", src).removeAttr( "id" ).attr("id", "flowplayer_pause"); 
						},
						onStart: function () {				
						 	var fd = parseInt(this.getClip().fullDuration, 10);
							var src="Images/pause.png";
							$("#flowplayer_play").attr("src", src).removeAttr( "id" ).attr("id", "flowplayer_pause"); 
						   $( "#progress_bar" ).hide();
							$( "#flowplayer_progress_bar" ).slider({
							range: "min",
							min: 0,
							max: fd,  // fd
							value: 0,
							slide: function( event, ui ) {
							$f("splash").seek(ui.value);        // we want f('splash') not the slider itself
							}}).show();	   
					}
					});	
			         change_id("flowplayer");   //swap all the button ids for use with flowplayer
					 $("#chrome img, #progress_bar").css({opacity:1}, "5000");	
					 $( "#flowplayer_progress_bar" ).slider("enable");
					 $.scrollTo("#header", "fast");
					 flowplayer_play();
				}
			});

Ok guys, I have found the problem! If anyone has the error in IE7 and 8:

Message: ‘null’ is null or not an object
Line: 1
Char: 158
Code: 0

There is nothing wrong with line one! This is the frustrating thing about this error, you examine the DocType declaration exhaustively in fear that you have made some clandestine doctype no-no that everybody seems to know about except you but in reality here is nothing wrong with line 1!!!

I don’t know if its because of the way IE parses the page but basicaly the error is referring to something that isn’t there in this case, a mistake in my JQuery - if( $(“#splash”)) should have been $(element).is(“:visible”).

All of the posts on this error say the same thing -syntax -check it over and over with a fine tooth comb and then check for elements that aren’t defined at the time the script is run.