JavaScript - Javascript Error Correction
Hi,
JSLint, is fantastic! However, it just shows errors -- no correction. Are there any online tools that are able to find and correct errors, especially missing semicolons at the end of statements? Thanks in advance! Best Rain Lover Similar TutorialsHy guys i have this error uncaught exception: [Exception... "Could not convert JavaScript argument" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: http://www.tgi.com.pt/merdo/scroll/ :: anonymous :: line 435" data: no] the problem is this code Code: <script type="text/javascript"> var gal = { init : function() { if (!document.getElementById || !document.createElement || !document.appendChild) return false; if (document.getElementById('gallery')) document.getElementById('gallery').id = 'jgal'; var li = document.getElementById('jgal').getElementsByTagNa me('li'); li[0].className = 'active'; for (i=0; i<li.length; i++) { li[i].style.backgroundImage = 'url(' + li[i].getElementsByTagName('img')[0].src + ')'; li[i].style.backgroundRepeat = 'no-repeat'; li[i].title = li[i].getElementsByTagName('img')[0].alt; gal.addEvent(li[i],function() { var im = document.getElementById('jgal').getElementsByTagNa me('li'); for (j=0; j<im.length; j++) { im[j].className = ''; } this.className = 'active'; }); } }, addEvent : function(obj, type, fn) { if (obj.addEventListener) { obj.addEventListener(type, fn, false); } else if (obj.attachEvent) { obj["e"+type+fn] = fn; obj[type+fn] = function() { obj["e"+type+fn]( window.event ); } obj.attachEvent("on"+type, obj[type+fn]); } } } gal.addEvent(window,'load', function() { gal.init(); }); </script> I thin this is a conflict between fancybox plug in and the script above http://www.tgi.com.pt/merdo/scroll/ I really need help... Thanks I am getting an error with a script and can't seem to figure out the problem. Firebug Error message: Error: document.forms[myform] is undefined Source File: https://www.domain.com/js/remember.js Line: 24 I have attached the HTML page and the remote javascript file. The script instructions said to include an onload action in the <BODY> tag as follows: <body background="/images/gold2.gif" onLoad="loadCookie(); displayFormData('my_form');"> BUT I was trying to use an even loader in the remote js file instead. Any help would be greatly appreciated. I was working on this script to change text with javascript and I ran into a problem. The code goes like this: PHP Code: <area shape="rect" coords="128,174,256,203" href="#" onClick="document.getElementById('content').innerHTML='<p class=first>Welcome to the first release of my Now every time I use an apostrophe in a word then when I click the link that corresponds to that writing, it doesn't do anything. Here's the link to my website: http://bittipiilo.com/msx/ By default you are on the Home tab. Then when you click either Gallery or Services and try to go back to Home, nothing happens. Can someone help me? When running my PHP code locally I am recieving the following error: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; BTRS26718; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; InfoPath.2; OfficeLiveConnector.1.5; OfficeLivePatch.1.3; Tablet PC 2.0) Timestamp: Thu, 7 Apr 2011 15:47:06 UTC Message: Object doesn't support this property or method Line: 4 Char: 1 Code: 0 URI: http://localhost/MowingSch.php ********************* * Selected Code ********************* Code: // JavaScript <script type='text/javascript'> function insCell(p1){ var wi = document.getElementById('Mowing').getElementsByName(p1).getElementsByTagName('td').length; if (wi == 3) { var x=document.getElementById(p1).insertCell(3); x.innerHTML='<?PHP echo $n; ?>'; var x=document.getElementById(p1).insertCell(4); x.innerHTML='<?PHP echo $p; ?>'; var x=document.getElementById(p1).insertCell(5); x.innerHTML='<?PHP echo $e; ?>'; } else { alert('Date selected is already assigned!'); } } </script> Code: // PHP Code $x = 0; for ($r = 0; $r <=27; $r++){ $id = 'tr'.$r; echo "<tr id=$id><TD><input id='SignUp' name=$id type='image' src='mow.png' name='mow' onclick='insCell($id)'></TD>"; for ($c = 0; $c <= 4; $c++) { if($data[$x + $c] <> ''){ echo "<td>" . $data[$x + $c] . "</td>"; } } echo "</tr>"; $x = $x + 5; } Would appreciate ANY assistance! Thanks. Hey guys, I'm a student taking JavaScript classes, I really like it so far and hope to really understand it in the next couple weeks. I'm doing my homework and just successfully coded a calendar (didn't take me very long, like I said, I'm catching on pretty quick and having fun) Having said that I'm not interested in getting any coding help, I simply like to further understand what I'm doing because I'm taking an online class. I'm going to show you my html and javascript file and I really need to understand why my address footer is in the middle? I have some HTML knowledge and know that since I put the address code at the bottom it should show up at the bottom. I deleted the linked .js file and it suddenly appeared at the bottom, therefore I'm thinking it has something to do with my javascript code. Does javascript act differently? Like I said, I'm not looking for anyone posting any kind of code, I'm just trying to understand what it is doing. Code: <title>Yearly Calendar</title> <link href="styles.css" rel="stylesheet" type="text/css" /> <link href="yearly.css" rel="stylesheet" type="text/css" /> <script src="yearly.js" type="text/javascript"></script> </head> <body> <div id="head"> <img style="float: right; border: 1px solid orange" src="photo.jpg" alt="" /> <img src="ccc.jpg" alt="Chamberlain Civic Center" /> </div> <div id="links"> <table><tr> <td><a href="#">Home</a></td><td><a href="#">Tickets</a></td> <td><a href="#">Events</a></td><td><a href="#">Directions</a></td> <td><a href="#">Hours</a></td><td><a href="#">Calendar</a></td> <td><a href="#">Tour</a></td><td><a href="#">Contact Us</a></td> </tr></table> </div> <div id="main" align="center"> <h1>Yearly Calendar</h1> <center><script type="text/javascript"> yearly() </script> </center> </div> <address> The Chamberlain Civic Center · 2011 Canyon Drive · Chamberlain, SD 57325 · (800) 555-8741 </address> </body> </html> Code: function yearly(calDate) { if (calDate == null) calendarDay=new Date() else calendarDay = new Date(calDate); var currentTime= calendarDay.getTime(); var thisYear= calendarDay.getFullYear(); document.write("<table id='yearly_table'><tr>"); document.write("<th id='yearly_title' colspan='4'>"); document.write(thisYear); document.write("</th>"); document.write("</tr>"); var monthNum = -1; for (var i=1; i<=3; i++) { document.write("<tr>") for (var j=1; j<=4; j++) { monthNum++; calendarDay.setDate(1); calendarDay.setMonth(monthNum); writeMonthCell(calendarDay, currentTime); } }write.document("</tr>"); write.document("</table>") } function writeMonthCell(calendarDay, currentTime) { document.write("<td class='yearly_months'>"); writeMonth(calendarDay, currentTime); document.write("</td>"); } function writeMonth(calendarDay, currentTime) { document.write("<table class='monthly_table'>"); writeMonthTitle(calendarDay); writeDayNames() writeMonthDays(calendarDay, currentTime); document.write("</table>"); } function writeMonthTitle(calendarDay) { var monthName = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); var thisMonth=calendarDay.getMonth(); document.write("<tr>"); document.write("<th class='monthly_title' colspan='7'>"); document.write(monthName[thisMonth]); document.write("</th>"); document.write("</tr>"); } function writeDayNames() { var dayName = new Array("Sun","Mon","Tue","Wed","Thu","Fri","Sat"); document.write("<tr>"); for (var i=0;i<dayName.length;i++) { document.write("<th class='monthly_weekdays'>"+dayName[i]+"</th>"); } document.write("</tr>"); } function daysInMonth(calendarDay) { var thisYear = calendarDay.getFullYear(); var thisMonth = calendarDay.getMonth(); var dayCount = new Array(31,28,31,30,31,30,31,31,30,31,30,31); if ((thisYear % 4 == 0)&&((thisYear % 100 !=0) || (thisYear % 400 == 0))) { dayCount[1] = 29; } return dayCount[thisMonth]; } function writeMonthDays(calendarDay, currentTime) { var weekDay = calendarDay.getDay(); document.write("<tr>"); for (var i=0; i < weekDay; i++) { document.write("<td></td>"); } var totalDays = daysInMonth(calendarDay); for (var dayCount=1; dayCount<=totalDays; dayCount++) { calendarDay.setDate(dayCount); weekDay = calendarDay.getDay(); writeDay(weekDay, dayCount, calendarDay, currentTime); } document.write("</tr>"); } function writeDay(weekDay, dayCount, calendarDay, currentTime) { if (weekDay == 0) document.write("<tr>"); if (calendarDay.getTime() == currentTime) { document.write("<td class='monthly_dates' id='today'>"+dayCount+"</td>"); } else { document.write("<td class='monthly_dates'>"+dayCount+"</td>"); } if (weekDay == 6) document.write("</tr>"); } I have a script: PHP Code: <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src="" + gaJsHost + "google-analytics.com/ga.js" type="text/javascript"%3E%3C/script%3E")); </script> <script type="text/javascript"> try { var pageTracker = _gat._getTracker("UA-13289331-1"); pageTracker._trackPageview(); } catch(err) {}</script> But firefox detects here an error which is: error: PHP Code: missing ) after argument list [Break on this error] document.write(unescape("%3Cscript src..."text/javascript"%3E%3C/script%3E"));n How I can fix that, because I didn't see what is wrong with ) symbol. I really can't figure this out... Hopefully you guys may have an idea. Basically I have an Ajax chat that stores a cookie. The first thing it does is checks to see if a cookie is set, if it's not it loads a box to where you can type your name (if it is it skips this), then it allows you to chat. The way I have this set up is on the index, I have a command that loads a php file. I pass through the html a variable... Code: ajaxFunction(3); When it gets to ajaxFunction(funct) I have this script; Code: if(funct == 1){ var source="file2.php"; var name = document.getElementById('name').value; status = 1; var queryString = "?name=" + name + "&status=" + status; } if(funct == 2){ var source="file1.php"; var shout = document.getElementById('shout').value; var color = document.getElementById('color').value; var bold = document.getElementById('bold').value; var queryString = "?shout=" + shout + "&color=" + color + "&bold=" + bold; } if(funct == 3){ var source="file2.php"; var name = document.getElementById('dfdf').value; status = 2; var queryString = "?name=" + name + "&status=" + status; } When the program first loads, it runs command 3 which checks to see if a cookie is set. If it is set, it returns a form Code: ................<INPUT TYPE=\"checkbox\" NAME=\"bold\" ID=\"bold\"> <input type=\"button\" onclick=\"ajaxFunction(2)\" value=\"Shout\"> ajaxFunction 2 then loads the chat box. If the cookie isn't set, it loads ajax function(1) which prompts their user for the name. The prompt for the name and the test for the cookie are in the same php file. I have it to where it gets the "status" and it runs the test in this order. PHP 1. Check to see if the person has a cookie (regardless to status) if true, run file1.php 2. If the person does not have a cookie set but status = 2, returns the prompt for the user to set a name. Code: echo "<form name=\"cookiedata\"> Name: <input type=\"text\" name=\"name\" id=\"name\" onChange=\"ajaxFunction(1)\" onkeypress=\"{if (event.keyCode==13)ajaxFunction(1)}\"> <input type=\"button\" onclick=\"ajaxFunction(1)\" value=\"Save\"> </form> "; //note, this actually replaces a div on the main page and does the prompt 3. If the person has a name set and is setting a cookie now, status = 1 then run file1.php Now the weird thing is, This thing works entierly on firefox... but for some reason when it loads in ie, i don't get the chat box. I don't get any errors either. For some reason, it doesn't seem to like the variable that is passed through to the php which is done like Code: var command = ""+source+""+queryString+""; ajaxRequest.open("GET", command, true); and recieved by php like Code: <?php include('config.php'); $status=$_GET['status']; $name = $_GET['name']; if($status==1){ do some code }else if($status==2){ do some code }.....................?> What is going on? How do I fix this with out splitting up the file in to two files? (before, it went to two seperate files, and it worked great... now they are both in the same file with a condition statement and nothing is working?) Hi Everyone, Iv got a button in my HTML5 document that when clicked gives an error. The button is coded as follows: Code: <input type="button" onclick="startGame();" value="Play!" /> The startGame function is held in an external JavaScript file. Whenever i run the code and click on the button i get an error that says startGame is not defined. Any ideas? Thanks, Luke Hi, I'm currently working on a Flash pop-up that can be integrated in several websites. I'm currently testing the code. I've got a flash file with a semi-transparant background that loads over the complete page, it also closes the div with the flash content once the end of the swf is reached. The thing is, I want to prevent the user from scrolling whilst the swf is active. That's why I disabled the overflow-Y. Now I've got a javascript code that is supposed to change the body's overflow to visible again, and I'm calling to this code in the same frame as where I disable the div with the flash in it. But for some reason it isn't working. This is my complete Javascript code: Code: <script type="text/javascript"> <!-- Original: Gregor (legreg@legreg.de) --> <!-- This script and many more are available free online at --> <!-- The JavaScript Source!! http://javascript.internet.com --> var ie4 = (document.all) ? true : false; var ns4 = (document.layers) ? true : false; var ns6 = (document.getElementById && !document.all) ? true : false; function hidelayer(lay) { if (ie4) {document.all[lay].style.visibility = "hidden";} if (ns4) {document.layers[lay].visibility = "hide";} if (ns6) {document.getElementById([lay]).style.display = "none";} } function writetolayer(lay,txt) { if (ie4) { document.all[lay].innerHTML = txt; } if (ns4) { document[lay].document.write(txt); document[lay].document.close(); } if (ns6) { over = document.getElementById([lay]); range = document.createRange(); range.setStartBefore(over); domfrag = range.createContextualFragment(txt); while (over.hasChildNodes()) { over.removeChild(over.lastChild); } over.appendChild(domfrag); } } <!-- This is the part I added which I thought would show the scrollbar again after the flashpopup is finished --> function showbar(){ document.getElementsByName('body')[0].style.overflowY = 'visible'; } </script> And in the final frame of my flash animation I first stop the swf, and then call to both functions: //stops the movie stop(); //this is the code that triggers the function to hide the div, and the function that should show the scrollbar getURL("javascript:showbar();"); getURL("javascript:hidelayer('newlayer');"); I've also got an online webtest he http://www.haragara.com/banner_test/ And I've included all the files in a zip Can anyone tell me what I'm doing wrong? When I go to a website and try to submit an online email to them I get as far as NEXT, to go forward, I receive this error message. JavaScript: Void ( ) Can you help A can't vote and see poll's result... http://tylko-kibice.pl/Administrator/polls/256/ Anybody knows a solution? Ok if you visit Event Flooring Gallery you will see that i have a js gallery with a number of images. The gallery itself is loading the images fine and you can click the buttons to seperate the images into their correct products. My problem is when i click the images the big version of the image should load but instead it gives me an error that the image may not exist or the path may be incorrect but ive checked on my laptop and every link is perfect its working fine on my laptop??? Any ideas?? Would it have anything to do with the images themselves as in they are each around 2mb or more each? Just want to be sure - I am trying to install cufon scripts and apparently we should "Add JavaScript error handling in case there is an error loading" Is this done like the following: Code: <script type="text/javascript"> function handleError() { return true; } window.onerror = handleError; </script> Thanks http://www.cricketcoachingclinics.com.au/ I am having a problem with site in IE7 this is identified as a problem?? Can someone at least rule out this js error? This is js generated when adding google maps Error Class is not defined <CODE>var GoogleMap=Class.create(Widget,{widgetIdentifier:"com-apple-iweb-widget-GoogleMap",initialize:function($super,instanceID,widgetPath,sharedPath,sitePath,preferences,runningI nApp) {if(instanceID){$super(instanceID,widgetPath,sharedPath,sitePath,preferences,runningInApp);}},mapReq uestTemplate:'center=#{center}&zoomLevel=#{zoomLevel}&showZoom=#{showZoom}&mapType=#{mapType}&locate dAddress=#{locatedAddress}&locatedAddressPoint=#{locatedAddressPoint}&showInfo=#{showInfo}&language= #{language}&showGoogleBar=#{showGoogleBar}',iframeTemplate:'<iframe id="#{instanceID}-iframe" name="#{instanceID}-iframe" src="#{mapURL}?#{mapRequest}" width="100%" height="100%" scrolling="no" marginheight="0" marginwidth="0" frameborder="0"></iframe>',mapURL:'http://www.me.com/st/1/sharedassets/maps/iweb2/',onload:function() {var mapRequestTemplate=new Template(this.mapRequestTemplate);var mapRequest=mapRequestTemplate.evaluate({center:this.escapedPreferenceForKey("center"),zoomLevel:this .escapedPreferenceForKey("zoomLevel"),showZoom:this.escapedPreferenceForKey("showZoom"),mapType:this .escapedPreferenceForKey("mapType"),locatedAddress:this.escapedPreferenceForKey("locatedAddress"),lo catedAddressPoint:this.escapedPreferenceForKey("locatedAddressPoint"),showInfo:this.escapedPreferenc eForKey("showInfo"),language:this.escapedPreferenceForKey("language"),showGoogleBar:this.escapedPref erenceForKey("showGoogleBar")});var iframeTemplate=new Template(this.iframeTemplate);var iframeText=iframeTemplate.evaluate({instanceID:this.instanceID,mapRequest:mapRequest,mapURL:this.map URL});this.div().innerHTML=iframeText;if(this.preferences&&this.preferences.postNotification) this.preferences.postNotification("BLWidgetIsSafeToDrawNotification",1);},escapedPreferenceForKey:fu nction(key) {var value=this.preferenceForKey(key);if(value!==undefined) value=encodeURIComponent(value);return value;}});</CODE> Hello. Recently my company's site has been acting funny. Images on the page bladv.com/work aren't displaying except in older/non-updated browsers. When I ran Firebug to check the javascript, I got the following message twice. "NetworkError: 404 Not Found - http://bladv.com/assets/_cache/00000000009939b9184d06e0feb33450dc78b54e11.js" Does anyone know why I'm getting this code, and would this be the reason images on the page bladv.com/work aren't showing up? If this is the problem, how do I fix it? I tried adding the js file into the cache folder but I'm still getting the error codes in Firebug and the images are still invisible. Hope that makes sense, I'm very very new to javascript. Thanks Hi all, I am working on a page that is using an image slider and a scrolling set of images and there seems to be some sort of conflict with the two because they both work on there own but as soon as they are both on the page one stops working. I have posted the javascript below in the hope that someone can point me in the right direction. I am anovice at best with javascript. I hope someone can help as I have looked everywhere Code: <script type="text/javascript" src="js/jquery.js" ></script> <script type="text/javascript" src="js/jquery-ui.min.js" ></script> <script type="text/javascript" src="js/jqueryslidemenu.js"></script> <script type="text/javascript"> $(document).ready(function(){ //$("#featured > ul").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, true); $("#featured").tabs({fx:{opacity: "toggle"}}).tabs("rotate", 5000, true); }); </script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"> </script> <!--<script type="text/javascript" src="/js/common.js"></script>--> <script type="text/javascript" src="http://simplyscroll.googlecode.com/files/jquery.simplyscroll-1.0.4.min.js"></script> <link rel="stylesheet" href="jquery.simplyscroll-1.0.4.css" media="all" type="text/css"> <script type="text/javascript"> (function($) { $(function() { $("#scroller").simplyScroll({ autoMode: 'loop' }); }); })(jQuery); </script> I would like to have a button just like for firebug, for error console, and that it would open error console window like for firebug. Is there a setting for that in FF, or some kind of addin outthere ?
Hi Folks, I'm new here, as well as to JavaScript, and am stuck. I'm trying to get something to validate using the W3C file validation, and I'm stuck. This is XHTML 1.0 Strick, and I know that isn't JS, but since the error involved JS I posted it here. If I would be better putting it in HTML please let me know. Everything works fine on the page, but I keep getting one single error. The > in Red is what shows up as the issue. Do ya'll see something glaringly obvious that I did wrong? Thanks for the help! Code: document.write("<a href='mailto:" + emLink + "' > "); Hi All, I am working on dot net framework 1.1.4322. From my html code of aspx file i have called a javascript function like 'onlick =javascript:saveorder()'. I have two copies of same code(identical - compared wit file compare tool) on different machine. When i run my code on one of the machine i get an error ';' expected which is a Javascript error and same time i wont get this error on another machine. When i searched on line number provided from error i saw few auto generated script which i have not putted there. Can anyone help me with the error at least with the reason. Thanks Mishigun |