JavaScript - Lightwindow Image Is 'null' ... :) !
hi!
i know little about programming, or javascript... ...i've set up several lightwindows on a site... ...fine in all browsers except IE (8 for sure, maybe others too...) ...the lightwindows load normally the first time they are clicked, but if they are closed and opened again, on the 2nd or subsequent times the window opens up at the bottom and an extra 'secret panel' (!) appears... ...in it it says, 'Null' on the left hand side, and 'by null', almost like a signature, on the right! The IE error message assoc. with this is: Message: 'null' is null or not an object Line: 5 Char: 5280 Code: 0 URI: http://www.kabeoke.com/swfobject.js And the FF error console (even though it works fine in FF...) says this: Error: $("lightwindow_image_" + i) is null Source File: http://www.p51labs.com/lightwindow/c...ipt.js,html.js Line: 5595 So the error is really specific to IE, and seems to involve javascript... ...can anyone help? Many Thanks Similar TutorialsI'm trying to integrate two different scripts, one being a PHP/CSS form (this part seems to be working fine) with a LightWindow script built by Kevin Miller: http://www.stickmanlabs.com/lightwindow/ I have installed the lightwindow script at: http://www.mikeandzachsbbq.com/Catering/ The Click Here link in the second paragraph opens the lightwindow, which shows the PHP form, located at http://www.mikeandzachsbbq.com/Catering/form.php If you go to form.php directly and fill out the form, it sends with no issues. However, if you fill out the form inside the lightwindow and click send, while it says that it sent successfully, no email is ever received. I've tried different form methods using the lighbox script, neither GET nor POST will make the email send inside the lightwindow. Anyone have any ideas? I'll try anything to get it working, or attach any needed files. Thanks a lot. Chris I'm not great with javascript and I'd appreciate any help or guidance. I'm using jquery colorbox to open a window when the page loads. However there is also a video player that automatically plays at the same time (flash). I'm trying to figure out how to modify the colorbox code so that the containing div for the video is initially hidden from view until the colorbox window is closed. The function to initialize it is: Code: $(document).ready(function() { $.fn.colorbox({href:"#inline_example1", width:"33%", inline:true, open:true}); }); Which I thought is where code should go to initially hide the div? Then I'm not sure but inside the actual colorbox code there is a function for closing the window. Is there a way to attach an event to that closing function that will change the hidden div to being visible? Code: $overlay.click(function () { if (settings.overlayClose) { publicMethod.close(); } }); Hello there everyone! I am currently rebuilding my portfolio and utilizing lightwindow as a means to display my projects. I have set up the site so that there is a grid of thumbnail images and also a textual list of links (basically another means for the user to navigate the projects if they prefer not to use the thumbnail links). For some projects I need to use the gallery function to display multiple images. I have this functioning when you click on the thumbnail link just fine. The problem is having the corresponding text link utilize the same set of images without creating a duplicate set. Is there a way to call the gallery without putting links to each image utilizing "class" and "rel". Here is a brief section of the html to show you what I mean...I have minimized it to show you clearly what I am trying to do... Code: <!-- Text List of Links to Projects --> <div id="subNav" style="display:none;"> <ul> <li class="listHeader">Web & Interactive</li> <li> <a href="imgs/gallery/proj1.jpg" class="lightwindow" title="Dynamic Info Design" caption="A caption can go here..." >Dynamic Info Design</a> </li> </ul> </div> <!-- Thumbnail Image Links to Projects --> <div id="portfolioContent"> <div id="thumbnail"> <!-- Set of Images to be used in gallery--> <a href="imgs/gallery/projectName/proj2A.jpg" class="lightwindow" title="Dynamic Info Design" caption="A caption can go here..." rel="Web & Interactive[Dynamic Info Design]"> <img src="imgs/thumbnails/project1.jpg" alt="Project Name" /> </a> <a href="imgs/gallery/projectName/proj2B.jpg" class="lightwindow" title="Dynamic Info Design" caption="A caption can go here..." rel="Web & Interactive[Dynamic Info Design]"></a> <a href="imgs/gallery/projectName/proj2C.jpg" class="lightwindow" title="Dynamic Info Design" caption="A caption can go here..." rel="Web & Interactive[Dynamic Info Design]"></a> </div> </div> I want to call that same set of 3 images with the text link <a href="imgs/gallery/proj1.jpg" class="lightwindow" title="Dynamic Info Design" caption="A caption can go here..." >Dynamic Info Design</a> Right now it's just showing the one image...if I use the rel tag in that link, it adds the image as a duplicate and then says there are 4 images in the set instead of 3. Does this make sense to anyone. How can I pull this same gallery up without duplicating the images or having the same project show up twice when you click on the gallery tab. View actual site in progress at: http://www.reneeclements.com/newWebs...sign/index.php Any insight would be greatly appreciated! Thanks! Reply With Quote Hey folks. I currently have a PTZ camera that is taking screenshots every minute (or so) and sending a copy of that image (overwriting the previous one) to my website. Basically, the visitors to the website will be greeted with a live screenshot. The problem is if the visitor hits the website at just the right time, the screenshot won't be loaded completely while the 2nd most screenshot is being overwritten... creating an empty image load (the dreaded red X). What I am looking to do with Javascript is to be able to load a generic image in the scenario in which no image loads. Is that possible? I tried doing something like the following and onload-ing it, but it wouldn't work. Any help would be appreciated. Thanks! Code: <script type="text/javascript"> <!-- function replaceSrc() { var images = document.getElementsByTagName('img'); for(var i = 0; i < images.length; i++) { var img = images[i]; if(img.src.length == 0) { img.src = 'images/garbage.gif'; } } } --> </script> Hi i have done some reading on the net today because i am getting an error on ie. I did find the javascript twice in my code, once in the header and once here, so i removed it from the header. I also changed to src to the full url. But i am still getting this and i dont know why. the file is located in the root directory. Code: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SearchToolbar 1.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; msn OptimizedIE8;ENUS) Timestamp: Sat, 30 Jul 2011 16:03:05 UTC Message: 'null' is null or not an object Line: 8 Char: 3894 Code: 0 URI: http://www.mysite.com/swfobject.js Code: <script type='text/javascript' src='$CONST_LINK_ROOT/swfobject.js'></script> <script type='text/javascript'> var s1 = new SWFObject('player.swf','player','400','300','9'); s1.addParam('allowfullscreen','true'); s1.addParam('allowscriptaccess','always'); s1.addParam('flashvars','file=$CONST_LINK_ROOT/movies/$sql_array->vid_id.flv'); s1.write('preview'); </script> <embed src='$CONST_LINK_ROOT/flvplayer.swf?file=$CONST_LINK_ROOT/movies/$sql_array->vid_id.flv&autoStart=false' width='175' height='175' quality='high' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed> would appreciate any suggestions thanks. i was on 1.5 swfobject i did download 2.2 and im guessing all you do is replace the swfobject.js file to upgrade it, but what happened is it gives me this now. Code: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SearchToolbar 1.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; msn OptimizedIE8;ENUS) Timestamp: Sat, 30 Jul 2011 16:31:08 UTC Message: 'SWFObject' is undefined Line: 1283 Char: 1 Code: 0 URI: http://www.mysite/video_admin.php?type=v i dont mind going back to the old version i just need to get this working and im soooooooo lost lol ok another update, this is becomming maddening lol. once i have this line in the header php Code: <script type='text/javascript' src='$CONST_LINK_ROOT/swfobject.js'></script> I never have to use it again as long as they header php is included correct? This is what is driving me nuts, im back on 1.5 and it says its undefined Code: but am in not defining it on this line? ---> var s1 = new SWFObject('player.swf','player','400','300','9'); <script type='text/javascript' src='swfobject.js'></script> <script type='text/javascript'> var s1 = new SWFObject('player.swf','player','400','300','9'); s1.addParam('allowfullscreen','true'); s1.addParam('allowscriptaccess','always'); s1.addParam('flashvars','file=$CONST_LINK_ROOT/movies/$sql_array->vid_id.flv'); s1.write('preview'); </script> Another Update. I am back to the original question. null is null or not an object.. in my search i have found this found a solution. basically Internet Explorer is crappy and doesnt like the setAttribute property so had to change the onchange handler by directly changing the attrbute for the object like so. object.onchange = function() {} i have no idea what they means, does that mean i need to change swfobject.js or does that mean i have to change my xml request. and if it is the swfobject i have no clue what they mean or what lines Hi I am having trouble with a script. I cannot figure out why I get the message: error: null is null or not an object (In IE8) The site is: www.rayburns.com I have check the javascript for the navigation bar and for the rotating images and cannot see what is missing. Not sure what is not being called. Can someone please help with this. Thank you in advance! Hi I've implemented Busybox on a website to display FLV files in a popup player. This works fine, except for the following error in IE (FF is fine) when I close the popup: 'null' is null or not an object I think I've narrowed it down to the following block of code, but am stuck as to what to do from here. Code: var cl = new Element('img',{ 'styles':{ width:'24px', height:'24px', position:'absolute', top:'-20px', right:'-20px', 'z-index':'100000' }, 'src':'bumpbox/closed.png', 'id':'closer' }) cl.addEvent('click',function(e){ e = new Event(e).stop(); bg.dispose(); $(el).getChildren().dispose(); eff2.start({ 'width':[maxw,1], 'height':[maxh,1], 'left': [endleft,middleH], 'top': [endtop, middleV+s] }) }) The IE error is just giving me line number 1 of the php, but the error, I'm sure, lays in the Javascript. Many thanks I know that unlike PHP, NULL in JavaScript must be quoted as a string. Does it matter if you use single or double quote?
For some reason i'm getting the error of "length is null". Which is from this . Code: function display_form(id) { //Create some variables var html = ""; var container = "form_container"; var menu = load_menu(id, false); //Get id for ( var i = 0; i < menu.length; i++ ) { alert(i); } http = getHTTPObject(); http.onreadystatechange = function() { if ( http.readyState == 4 && http.status == 200 ) { document.getElementById(container).innerHTML = http.responseText; } else { document.getElemenyById(container).innerHTML = "Loading..."; } } http.open( "GET", "includes/forms.php?form=" + id ); http.send(); //Watch input fields //login_listener(); }/* Here is the function: Code: function load_menu(menu, return_d) { //Availible menus var data = []; data [ 'login' ] = [ 'Login', 'Register', 'Recovery' ]; data [ 'settings' ] = [ 'Profile', 'Account', 'something' ]; if (return_d == false) { return data[ menu ]; } else { //Menu container ID's var cons = Array('menuitem1','menuitem2','menuitem3'); for ( var i = 0; i < cons.length; i++ ) { document.getElementById(cons[i]).innerHTML += data[ menu ] [ i ]; } } } Extra info: id = login menu = login On my site I have a Javascript error in my FireBug console: Year is 'null' Code: document.getElementById('year').options[i] = new Option(curr_year-i,curr_year-i); here is my site: http://harveys.blueplanetdns.com/harveys-shop/ I need to check to see if a cookie has been previously created: Code: var startnum = readCookie('a1'); if (document.cookie.indexOf('a1') == -1){ var startnum = "0"; } Should line 2 be: Code: if (document.cookie.indexOf('a1') == null){ ? Does == -1 do the same thing? New problem, taken from another website I posted this on: Error: Code: Error ``user_node[0].firstChild is null'' [x-] in file ``*url removed*'', line 63, character 0. As you can see it says that the value is NULL although it shouldn't be... Here is the JavaScript which the error refers to: Code: function manageMessage() { if( receiveReq.readyState == 4 ) { // request complete var chat_div = document.getElementById( 'chat' ); var xmldoc = receiveReq.responseXML; var msg_nodes = xmldoc.getElementsByTagName( 'message' ); var n_msg = msg_nodes.length; for( i = 0; i < n_msg; i++ ) { alert(i + "," + n_msg); var user_node = msg_nodes[ i ].getElementsByTagName( 'user' ); var time_node = msg_nodes[ i ].getElementsByTagName( 'time' ); var text_node = msg_nodes[ i ].getElementsByTagName( 'text' ); alert(user_node[0].firstChild.nodeValue); //Display message chat_div.innerHTML += user_node[ 0 ].firstChild.nodeValue + "<br />"; chat_div.innerHTML += time_node[ 0 ].firstChild.nodeValue + "<br />"; chat_div.innerHTML += text_node[ 0 ].firstChild.nodeValue + "<br /><br />"; } } } And again, the whole script if you want it... Code: <script type="text/javascript"> //Credits// //Help: Greg (Gjslick) //Code example: http://www.dynamicajax.com/fr/AJAX_Driven_Web_Chat_Backend-271_290_291_296.html // Declare Global Variables var lastMess; var sendReq; var receiveReq; var mTimer; // Initialize Global Variables (on page load) function init() { lastMess = 0; sendReq = getXmlHttpRequestObject(); receiveReq = getXmlHttpRequestObject(); mTimer; } function getXmlHttpRequestObject() { if( window.XMLHttpRequest ) { return new XMLHttpRequest(); // code decent browsers like Firefox, Chrome, Opera, Safari. And IE7+... } else if( window.ActiveXObject ) { return new ActiveXObject( 'Microsoft.XMLHTTP' ); //Code for crap like IE } else { var statusEl = document.getElementById( 'p_status' ); statusEl.innerHTML = "Status: Could not create XmlHttpRequest Object, please upgrade your browser!"; return null; } } function getMessage() { //var url = "scripts/get_data.php?uid=<?=$uid?>&m=" + lastMess + "&chat=1"; var url = "testXMLdoc.xml"; receiveReq.open("GET",url,true); receiveReq.onreadystatechange = manageMessage; receiveReq.send( null ); lastMess++; } function manageMessage() { if( receiveReq.readyState == 4 ) { // request complete var chat_div = document.getElementById( 'chat' ); var xmldoc = receiveReq.responseXML; var msg_nodes = xmldoc.getElementsByTagName( 'message' ); var n_msg = msg_nodes.length; for( i = 0; i < n_msg; i++ ) { alert(i + "," + n_msg); var user_node = msg_nodes[ i ].getElementsByTagName( 'user' ); var time_node = msg_nodes[ i ].getElementsByTagName( 'time' ); var text_node = msg_nodes[ i ].getElementsByTagName( 'text' ); alert(user_node[0].firstChild.nodeValue); //Display message chat_div.innerHTML += user_node[ 0 ].firstChild.nodeValue + "<br />"; chat_div.innerHTML += time_node[ 0 ].firstChild.nodeValue + "<br />"; chat_div.innerHTML += text_node[ 0 ].firstChild.nodeValue + "<br /><br />"; } } } </script> And here is the XML file (test doc for now): Code: <?xml version="1.0" ?> <root> <message id="1"> <user></user> <text>testing stupid chat thing</text> <time>0000-00-00 00:00:00</time> </message> <message id="2"> <user></user> <text>dsadasfsdfsggsdgrgsdgfd</text> <time>2010-04-22 19:17:16</time> </message> </root> I'm guessing this question will be one of the easiest questions ever posted but I'm just not getting this fix. I have a simple Javascript program that calculates a users pace for their run. The inputs are done through an HTML Form. The user can input hours, minutes, & seconds of their run. Then the distance number & measurment. Then finally the pace desired. I am having some trouble with null values in this program. If I input a 0 in hours and then fill everything out the program works great. 100%! But, if I leave the field blank and hit calculate I get a NaN. I'm guessing I need some kind of statement like if this value is null set it to zero but I am not having any luck with exactly what kind of syntax I need. So here is the code, again not very complex, any help would be greatly appreciated! function calculateTime(){ var time_hour = parseInt(document.getElementById("time_hour").value); var time_min = parseInt(document.getElementById("time_minute").value); var time_sec = parseFloat(document.getElementById("time_second").value); var dist_num = parseFloat(document.getElementById("dist_num").value); var pace_choice = document.getElementById("pace_choice").selectedIndex; var dist_choice = document.getElementById("dist_choice").selectedIndex; var total_sec = (time_hour * 3600) + (time_min * 60) + (time_sec); // Then I'm guessing my if statement would go here somewhere? Bonjour all. I am trying to activate a function once an iframe is closed. so i am trying to use: window.opener.pageUpdate(); which i get an error of Error: window.opener is undefined Source File: https://web111.secure-secure.co.uk/s...js/thickbox.js Line: 270 Which lead me to believe that my parent window has not got a name so i used window.name = "main"; in my parent and window.main.pageUpdate(); in the child and get same kind of error. Could someone please help me out! Hello, I'm working on web apps for a company and unfortunately the websites work in Mozilla, chrom and IE9 but not in IE8. In IE8 the error message "undefined is null or not an object" is pointing to this line: temp = val.replace(/-/g, "/"); That line is inside a function. I'm not sure how to troubleshoot this...any help would be appreciated. When i did a view source , checkbox names are displayed as MedicalAction_listOfTransfers_[0]__rowSelected' so each checkbox has different name and id as well all i am trying to do here is to put a checkall/uncheckall option , also in the jsp page we have a pagination so is that something that cause the checkbox value as null ? function MoveAll(){ var lengthofRecords = document.getElementById('resultsSize').value; for (i = 0; i < lengthofRecords; i++){ var name = 'MedicalAction_listOfTransfers_'+i+'__rowSelected'; var checkBox = document.getElementById(name); alert("check box B4: " + checkBox); - // I AM GETTING NULL VALUE HERE checkBox.checked=checkBox.checked == false ? true:false; alert("check box A4: " + checkBox.checked); //checkBox.checked = checkBox.checked? true:false; } } Please help i am newbie Hello, I'm working on some php and javascript. I have php creating some forms using values from a database and wrapping them in divs called showform1, showform 2 etc I then want to use Javascript to show one form at a time when I click on a tickbox. So I've got it working so when you click on a checkbox and it shows the right form, but I want it to hide all the others first so it only shows one at a time if possible. When I do this is errors saying document.getElementById(showform1) is null - it does this for all the forms not just the first one. My php goes like this: PHP Code: $i=1; //loop through all things in db while ($info_query = mysql_fetch_assoc($info)) { ?> <label>Item <?php echo $i;?></label> <input type="radio" name="show" value="show" onclick="showhide(this.value,'showform<?php echo $i;?>')"/> //here's the div with the dynamically generated ID... <div id="showform<?php echo $i;?>" style="visibility:hidden;height:0px;"> <p> info for item 1 </p> </div> //increment the counter so the next div has a different name $i=$i+1; } My Javascript looks like this: Code: <script type="text/javascript"> function showhide(radval,divid) { if(radval=="show") { <?php //hide them all first $i=1; while ($details_query = mysql_fetch_assoc($details)) {?> var showform<?php echo $i;?>; document.getElementById(showform<?php echo $i;?>).style.visibility="hidden"; document.getElementById(showform<?php echo $i;?>).style.height="0px"; <?php $i=$i+1; } //then show just the one ticked ?> document.getElementById(divid).style.visibility="visible"; document.getElementById(divid).style.height="auto" } } </script> the details and info queries are the same query...each looping through the same data. It works if I don't hide all the values first, and shows each form when I tick the box, but if I try to hide them all and THEN make one visible, the first line that hides the divs always errors. I've moved the JS around to the footer, the header in case its because stuff hasn't loaded yet, but it doesn't make sense as it has loaded to work to show the div. Really appreciate your help. Thanks, Nicola Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title></title> <script language="javascript" type="text/javascript"> alert (document.body); </script> </head> <body> </body> </html> EDIT: moved script to after body, and now it works. Not the way it should be done I think ? I cant figure out why this doesnt work - Firefox says: Error: document.getElementById("test") is null Source File: file:///Users/briantoovey/test.html Line: 10 Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" /> <title>Rotating Quotes</title> </head> <body> <script type="text/javascript"> document.getElementById("test").innerHTML = 'eat it'; </script> <div id="test"></div> </body> </html> |