JavaScript - Problem Isolating Js Error On Ie
I have a script that works fine on Firefox but fails with an "Object expected" error on IE7. Frustratingly IE will not tell me where the error is. It reports a line number and the URL of the invoking page, but does not identify in which actual JS file the problem occurred.
I narrowed down that the problem was occurring in a call to a particular function. I did this by wrapping a try/catch around the call: Code: try { initCit(); } catch(e) { alert("editEvent.js: loadEdit: error=" + e.message); } Then I wrapped a try catch around the entire contents of the function initCit: Code: function initCit() { try { var citTable = document.getElementById('citTable'); citTable.updateRow = updateRow; // feedback from editCitation.php var form = citTable.parentNode; while(form.nodeName != 'FORM') form = form.parentNode; // define onclick handlers for some elements var formElts = form.elements; for (var i = 0; i < formElts.length; ++i) { // loop through elements var elt = formElts[i]; if (elt.id.substr(0,12) == "editCitation") elt.onclick = editCitation; else if (elt.id.substr(0,11) == "delCitation") elt.onclick = deleteCitation; else if (elt.id == "addCitation") elt.onclick = addCitation; } // loop through elements } catch (e) { alert("citTable.js: initCit: error" + e.message); } // catch } // initCit The outer try/catch is the only one that catches. Furthermore if I add an alert as the first line of the function initCit it is not displayed. To observe an example of this go to: http://www.jamescobban.net/FamilyTre...er=300&type=30 How do I fix this? Similar TutorialsI have a JavaScript function that Clears the values in all of the elements. This works fine, however, I want to modify the scriipt to clear some of the elements and leave the others alone. I seem to be having a problem getting the function to recognize the elements. (See Code). Code: function ClearAllControls() { for (i = 0; i <= document.forms[0].length; i++) { doc = document.forms[0].elements[i]; //alert(doc.name + " - " + doc.type); switch (doc.type) { case 'text': doc.value = ''; break; /* switch (doc.name){ default:doc.value = ''; }*/ case 'textarea':doc.value = ''; break; case 'checkbox':doc.checked = false; break; case 'select-one': //doc.options[0].selected = true; //alert(doc.name + " - " + doc.type); switch(doc.name){ case 'uwtBSSignUp$_ctl0$ddlmodel':alert(doc.name + " - " + doc.type); break; case 'uwtBSSignUp$_ctl0$ddlbuilding':break; case 'uwtBSSignUp$_ctl0$ddlfloor'break; default:doc.options[0].selected = true; break; } break; default:break;} } var webTab = document.forms[0].getElementById('uwtBSSignUp'); if(webTab){alert('found');return;} } The nested switch statement is failing. The uwtBSSignUp element is a Infragistic Tab Control. I'm trying to prevent some of the controls on the tab panels not to clear. In addition the function doesn't run the alert to notify me that the tab control was recognized. If I run just the first switch statement it works and clears all of the elements. Am I using the right syntex or something? i have a variable $page that is storing code similar to this PHP Code: onloadRegister(function (){Quickling.init("329319;0", 10, {"page_cache":1,"quickling_init_page":false,"flush_cache_in_transition":1,"flush_cache_in_page_write":0});}); onloadRegister(function (){JSCC.init({"j4d235b8b8399023097431421":function(){return new AsyncLayout();}}, false);}); onloadRegister(function (){JSCC.init({"j4d235b8b8399023097431422":function(){return new SearchDataSource({"maxResults":8,"queryData":{"viewer":100000503667042},"queryEndpoint":"\/ajax\/typeahead\/search.php","bootstrapData":{"viewer":100000503667042,"token":"1294162702-5","lfe":1},"bootstrapEndpoint":"\/ajax\/typeahead\/first_degree.php"});},"j4d235b8b8399023097431423":function(){return new Typeahead(JSCC.get('j4d235b8b8399023097431422'), {node: $("u282757_1"), ctor: "SearchTypeaheadView", options: {"autoSelect":true,"renderer":"search"}}, {node: $("q"), ctor: "SearchTypeaheadCore", options: {"keepFocused":false,"resetOnSelect":true}}, $("u282757_2"))}}, false);}); onloadRegister(function (){window.__UIControllerRegistry["c4d235b8b883d27291189921"] = new UIPagelet("c4d235b8b883d27291189921", "\/pagelet\/profile\/tux_toolbar.php", {"profile_id":100000503667042,"sk":"wall"}, {});; ;}); onloadRegister(function (){ft.enableFeedTracking();}); onloadRegister(function (){JSCC.get('j4d235b8b8399023097431421').init($("contentArea"), $('rightCol'), $('headerArea'), $('toolbarContainer'));}); onloadRegister(function (){window.loading_page_chrome = true;}); PHP Code: $page = curl_exec($curl_handle); $d = json_decode($page); $profileid = $d['profile_id']; htmlOut("kevins profile id = ".$profileid); function htmlOut($var){ echo "<hr /><b>".$var."</b><hr />"; } This is what i have but its not isolating the profile id does anybody know how i can do this please the id im looking for is 100000503667042 thanks for any help provided. I have an ASP.Net page using a JavaScript File. The function in this file that resets the values of the elements works fine. Now I need to advance this function to reset some and not reset others. I can't seem to get the function to recognize the individual elements. I've tried many different syntaxes to make it happen with no luck. Most of the elements reside in a tab control (parent). I am using a nested Switch statement and the name as returned by doc.name method. Please reveiw the code below and see what I'm doing wrong. Code: for (i = 0; i <= document.forms[0].length; i++) { doc = document.forms[0].elements[i]; //alert(doc.name + " - " + doc.type); switch (doc.type) { case 'text': doc.value = ''; break; /* switch (doc.name){ default:doc.value = ''; }*/ case 'textarea':doc.value = ''; break; case 'checkbox':doc.checked = false; break; case 'select-one': //doc.options[0].selected = true; //alert(doc.name + " - " + doc.type); switch(doc.name){ case 'uwtBSSignUp_ctl0_ddlmodel':alert(doc.name + " - " + doc.type); break; case 'uwtBSSignUp$_ctl0$ddlbuilding':break; case 'uwtBSSignUp$_ctl0$ddlfloor'break; default:doc.options[0].selected = true; break; } break; default:break;} } Hi there, I have this form that validates a few textboxes & a dropdownlist. And when it is not filled in, the border of the textboxes and dropdownlist would turn red, followed by an alert message notifying which field have not been filled in. Else, the border will revert back to black, and the form will be submitted successfully. There's a problem whereby when everything is filled in, the alert message still pops up. Any kind souls to help me? Thanks in advance. Javascript Code: function check(checkForm) { var fields = new Array("Name","Email Address", "Domain Name"); var index = new Array(),k=0; for(var i=0;i<fields.length;i++) { var isFilled = false; var c = document.getElementsByName(fields[i]); for(var j = 0; j < c.length; j++) if(!c[j].value == "") { isFilled = true; c[j].className = "defaultColor"; } else { c[j].className ="changeToRed"; } if(!isFilled) { index[k++] = fields[i]; } } if(k.length!=0) { joinComma = index.join(', '); alert('The field(s) corresponding to '+ joinComma + ' is/are not selected.'); return false; } } HTML Code: *Last Name: <input type="text" id="Text27" name="Last Name" /><br /> <br /> *Email Address: <input type="text" id="Text28" name="Email Address" /> @ <select id="Select5" name="Domain Name"> <option></option> <option>hotmail.com</option> <option>yahoo.com</option> </select> <input id="Submit5" type="submit" value="Submit" onclick="return check(checkForm)"/> I had posted a previous forum for help and solved a problem. However, than the links lost their formatting in the browser. I kept going as I am doing a lesson out of a textbook and the links are fixed now, but my coded object is not showing up. There should be a calendar in the upper righthand corner. I posted the javascript first and only a section of html after. Code: function calendar() { var calDate = new Date("March 18, 2011"); document.write("<table id='calendar_table'>"); writeCalTitle(calDate); writeDayNames(); writeCalDays(calDate); document.write("</table>"); } function writeCalTitle (calendarDay) { var monthName = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); var thisMonth=calendarDay.getMonth(); var thisYear=calendarDay.getFullYear(); document.write("<tr>"); document.write("<th id='calendar_head' colspan='7'>"); document.write(monthName[thisMonth]+" "+thisYear); 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='calendar_weekdays'> "+dayName[i]+"</th>"); } document.write("<tr>"); } function daysInMonth(calendarDay) { var thisYear = calendarDay.getFullYear(); var thisMonth = calendayDay.getMonth(); var dayCount = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); if (thisyear % 4 == 0) { if((thisyear % 100 != 0) || (thisyear % 400 == 0)){ dayCount[1] = 29; //this is a leap year } } return dayCount[thisMonth]; } function writeCalDays(calendarDay){ var dayCount = 1; var totalDays = daysInMonth(calendarDay); calendarDay.setDate(1); var weekDay = calendarDay.getDay(); document.write("<tr>"); for (var i = 0; i < weekday; i++) { document.write("<td></td>"); } while (dayCount <= totalDays) { if (weekDay == 0) document.write ("<tr>"); document.write("<td class='calendar_dates'>"+dayCount+"</td>"); if (weekday == 6) document.write ("</tr>"); dayCount++; calendarDay.setDate(dayCount); weekDay = calendarDay.getDay(); } document.write("</tr>"); } Code: <title>The Chamberlain Civic Center</title> <link href="ccc.css" rel="stylesheet" type="text/css" /> <link href="calendar.css" rel="stylesheet" type="text/css" /> <script src="cal.js" type="text/javascript"></script> </head> <body> <div id="head"> <script type="text/javascript"> calendar(); </script> <img src="logo.gif" alt="Chamberlain Civic Center" /> </div> If you want, I can upload the files to my school server so you can view the webpage in a browser. The error console says that there is a missing parenthetical where I have the ! symbol. I don't see that. Also it says that calendarDay is not defined. Hi, For the life of me I can't work out what is wrong with the code he http://www.spencercarpenter.co.uk/po...162&fgh=showMe I know it is somthing to do with the url and that it is a synax error but I really am stuck as I cant see what it is. If anyone could help me resolve this I would be very grateful. Thanks for any help. Spencer FireFox is throwing a DOM security error. And i don't really know why. i've used toDataURL() before, and it's never done this. Hopefully i can get this little app fixed, so that i can use it on my TabletPC for taking notes in class. The line of code that is throwing this error is: Code: var Note = document.getElementById("SketchPage").toDataURL(); here's the full error from the Error Console: Error: uncaught exception: [Exception... "Security error" code: "1000" nsresult: "0x805303e8 (NS_ERROR_DOM_SECURITY_ERR)" location: "file:///C:/SketchBook-Dev/SketchBook.js Line: 236"] here is the JS file: Code: var PenSize = "3"; var PenShape = "Circle"; var PenColor = "Black"; var LoadFile = ""; var UIstatus = "visible"; var CurrentNote = 0; var BGcolor = "#C7C1A3"; var DataPath = "\Data\\"; var ImageExtension = ".img"; var FileList = []; var SystemPath; var UIstatus = "visible"; var Server = "localhost"; var NxtNote = new Image(); document.onkeyup = ToggleUI; function Init() { // Get the System Path GetSystemPath("SketchBook.html"); // Load All Filenames of the DataPath directory into an array GetFileList(SystemPath + DataPath, FileList); //Load the first Note onto the canvas // if there are no notes in the directory, don't try to load anything if(FileList.length > 0) { var Source = LoadFromDisk(FileList[CurrentNote]); NxtNote.src = Source; // Load the image data onto the canvas var canvas = document.getElementById('SketchPage').getContext('2d'); canvas.drawImage(NxtNote , 0, 0); } } function HideOptions() { document.getElementById("Options").style.visibility = "hidden"; } function ToggleUI(e) { var KeyID = (window.event) ? event.keyCode : e.keyCode; var KeyValue = 18; // Use a key to hide the toolbars so that most of the screen is used for the UI if(KeyID == KeyValue) { if(UIstatus == "visible") { UIstatus = "hidden"; document.getElementById("UI").style.visibility = "hidden"; return; } if(UIstatus == "hidden") { UIstatus = "visible"; document.getElementById("UI").style.visibility = "visible"; } } } function ShowOptions() { document.getElementById("Options").style.visibility = "visible"; } function UpdatePenSize() { PenSize = document.getElementById('GetPenSize').value; } function UpdatePenShape() { PenShape = document.getElementById('GetPenShape').value; } function UpdatePenColor() { PenColor = document.getElementById('GetPenColor').value; } function Draw(element, event) { document.addEventListener("mousemove", PenHandler, true); document.addEventListener("mouseup", upHandler, true); event.stopPropagation(); event.preventDefault(); function PenHandler(event) { var x = event.clientX; var y = event.clientY; // mouse event goes here var canvas = document.getElementById("SketchPage"); var ctx = canvas.getContext("2d"); if (PenShape ="Circle") { // This draws a circle ctx.fillStyle = PenColor; ctx.beginPath(); ctx.arc(x, y, PenSize, 0, Math.PI*2, true); ctx.closePath(); ctx.fill(); } event.stopPropagation(); } function upHandler(event) { document.removeEventListener("mouseup", upHandler, true); document.removeEventListener("mousemove", PenHandler, true); event.stopPropagation(); } } function SaveNote() { // Get the current file name var FileName = SystemPath + DataPath + CurrentNote + ImageExtension; // Convert the Canvas Data into a Base64 encoded PNG image var Note = document.getElementById("SketchPage").toDataURL(); // Write the PNG file to the disk SaveToDisk(FileName, Note); } function NextNote(Direction) { if(Direction == "up") { // Display the previoius note CurrentNote--; // Make sure you don't incrimnet to a non-existant note if(CurrentNote <= 0) { CurrentNote = FileList.length; } var Source = LoadFromDisk(FileList[CurrentNote]); NxtNote.src = Source; // Load the image data onto the canvas // Clear the Pre-existing Canvas Data First ClearSketch(); var canvas = document.getElementById('SketchPage').getContext('2d'); canvas.drawImage(NxtNote, 0, 0); return; } if(Direction == "down") { //Display the Next note CurrentNote++; // Make sure you don't incrimnet to a non-existant note if(CurrentNote > FileList.length) { CurrentNote = 0; } var Source = LoadFromDisk(FileList[CurrentNote]); NxtNote.src = Source; // Load the image data onto the canvas // Clear the Pre-existing Canvas Data First ClearSketch(); var canvas = document.getElementById('SketchPage').getContext('2d'); canvas.drawImage(NxtNote, 0, 0); return; } } function DeleteNote() { // Delete The current note DeleteFile(SystemPath + DataPath + FileList[CurrentNote]); // Reload the Directory List // Clear the FileList Array FileList = []; GetFileList(SystemPath + DataPath, FileList); // Load The Previous Note // Display the previoius note CurrentNote--; // Make sure you don't incrimnet to a non-existant note if(CurrentNote <= 0) { CurrentNote = FileList.length; } var Source = LoadFromDisk(FileList[CurrentNote]); NxtNote.src = Source; // Load the image data onto the canvas var canvas = document.getElementById("SketchPage"); var context = canvas.getContext("2d"); canvas.drawImage(NxtNote, 0, 0); return; } function AddNote() { // Add a note to the notebook and at the end of the File List // **** Later this function should be modified to be an INSERT function rather than just an add // Just incase the user needs to go back an edit and add more things to their notebook CurrentNote++; // Add the new Note File name to the end of the FileList Array FileList.push(CurrentNote + ImageExtension); // Clear the Canvas ClearSketch(); // Write a blank image file to the Data directory so that we have the actual file there var FileName = SystemPath + DataPath + CurrentNote + ImageExtension; var Note = document.getElementById("SketchPage").toDataURL(); } function ClearSketch() { // Clear the contents of the Canvas //Draw a rectangle that covers the canvas var canvas = document.getElementById("SketchPage"); var ctx = canvas.getContext("2d"); ctx.fillStyle = BGcolor; ctx.fillRect (0, 0, canvas.width, canvas.height); } function Crypt(method) { // This function will Encrypt or Decrypt All the NoteData if(method == "encrypt") { return; } if(method == "decrypt") { return; } } function Archive(method) { // This function will Restore or Backup all NoteData to a network resource if(method == "restore") { return; } if(method == "backup") { return; } } // ******************** These are the XPCOM Functions ************************ function GetSystemPath(ApplicationName) { // This function should Detect the system directory of the app // and return that string as the SystemPath variable // You must supply the filename of the HTML file that it is being called from // I suppose later i could add the code to detect the HTML's actual file name // It's on the ToDo List... var GetSysPath = self.location; GetSysPath = GetSysPath + ""; Get = GetSysPath.replace("file:///" , ""); Get = Get.replace(/\//g , "\\"); Get = Get.replace(ApplicationName, ""); SystemPath = Get; return SystemPath; } function DeleteFile(FileName) { // Delete a local file netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var aFile = Components.classes["@mozilla.org/file/local;1"].createInstance(); if (aFile instanceof Components.interfaces.nsILocalFile) { aFile.initWithPath(FileName); aFile.remove(false); } } function GetFileList(Directory, FileList) { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var _nsILocalFile = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); // initialize path to work with _nsILocalFile.initWithPath(Directory); // get file interface implemenation // this means that an XPCOM Class can implement multiple interface var lv_oFile = _nsILocalFile.QueryInterface(Components.interfaces.nsIFile); var lv_oEntries = lv_oFile.directoryEntries; while(lv_oEntries.hasMoreElements()) { var lv_cFile = lv_oEntries.getNext() .QueryInterface(Components.interfaces.nsIFile).path; FileList.push(lv_cFile); } } function SaveToDisk(filepath, content) { try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); } catch (e) { alert("Permission to save file was denied."); } var file = Components.classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile); file.initWithPath( filepath ); if ( file.exists() == false ) { file.create( Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 420 ); } var outputStream = Components.classes["@mozilla.org/network/file-output-stream;1"] .createInstance( Components.interfaces.nsIFileOutputStream ); outputStream.init( file, 0x04 | 0x08 | 0x20, 420, 0 ); var output = content; var result = outputStream.write( output, output.length ); outputStream.close(); } function LoadFromDisk(filePath) { if(window.Components) try { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); file.initWithPath(filePath); if (!file.exists()) return(null); var inputStream = Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream); inputStream.init(file, 0x01, 00004, null); var sInputStream = Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream); sInputStream.init(inputStream); return(sInputStream.read(sInputStream.available())); } catch(e) { //alert("Exception while attempting to load\n\n" + e); return(false); } return(null); } and the HTML UI code: Code: <html><head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <title>Sketch Book v1.0</title> <script src="SketchBook.js" type="text/javascript"></script> <script src="JSxpcom.js" language="text/javascript"></script> </head> <body onLoad="Init();"> <div id="SketchPageView"> <canvas id="SketchPage" width="480" height="640" style="background: #C7C1A3; position: absolute; top: 0px; left: 0px;" onmousedown="Draw(this, event);"></canvas> </div> <div id="Options" style="position: absolute; visibility: hidden; top: 100px; left: 50px;"> <table cellwidth="100" border="0" cellpadding="0" cellspacing="0" height="50"> <tbody><tr><td><img src="./Image/TL-black.PNG" height="19" width="19"></td><td bgcolor="#bce0f8"><center><b>Options</b></center><img src="./Image/delete.png" style="position:absolute; top: 2px; left: 150px; height: 18; width: 18;" onClick="HideOptions();"></td><td><img src="./Image/TR-black.PNG" height="19" width="19"></td></tr> <tr><td bgcolor="#bce0f8"></td> <td bgcolor="#bce0f8"> <div style="border: 1px solid black;"> <table> <tbody><tr> <td><center>Pen Size</center></td><td><center>Color</center></td> </tr> <tr> <td> <select id="GetPenSize" onchange="UpdatePenSize();"> <option value="1">1 px</option> <option value="2">2 px</option> <option value="3">3 px</option> <option value="4">4 px</option> <option value="5">5 px</option> </select> </td> <td> <select id="GetPenColor" onchange="UpdatePenColor();"> <option value="Black">Black</option> <option value="White">White</option> <option value="Red">Red</option> <option value="Blue">Blue</option> <option value="Green">Green</option> <option value="Brown">Brown</option> </select> </td> </tr> <tr> <td><input value="Restore" onclick="RestoreData();" type="button"></td><td><input value="Backup" onclick="BackupData();" type="button"></td> </tr> <tr> <td><input value="Encrypt" onclick="EncryptData();" type="button"></td><td><input value="DeCrypt" onclick="DecryptData();" type="button"></td> </tr> </tbody></table> </div> </td> <td bgcolor="#bce0f8"></td></tr> <tr><td><img src="./Image/BL-black.PNG" height="19" width="19"></td> <td bgcolor="#bce0f8"></td><td align="right"><img src="./Image/BR-black.PNG" height="19" width="19"></td></tr> </tbody></table> </div> <table id="UI" style="position: absolute; top: 0px; left: 412px; visibility: visible;" border="0" cellpadding="0" cellspacing="0" width="40"> <tbody><tr><td><img src="./Image/TL-black.PNG" height="19" width="19"></td><td bgcolor="#bce0f8"></td><td><img src="./Image/TR-black.PNG" height="19" width="19"></td></tr> <tr><td bgcolor="#bce0f8"></td> <td bgcolor="#bce0f8" height="600"> <img src="./Image/up.png" style="width: 30px; height: 30px;" alt="up" onclick="NextNote('up');"><br><br><br><br> <img src="./Image/plus.png" style="width: 30px; height: 30px;" alt="add" onclick="AddNote();"><br><br><br><br> <img src="./Image/save.png" style="width: 30px; height: 30px;" alt="save" onclick="SaveNote();"><br><br><br><br> <img src="./Image/clear.png" style="width: 30px; height: 30px;" alt="clear" onclick="ClearSketch();"><br><br><br><br> <img src="./Image/delete.png" style="width: 30px; height: 30px;" alt="delete" onclick="DeleteNote();"><br><br><br><br> <img src="./Image/gear.png" style="width: 30px; height: 30px;" alt="options" onclick="ShowOptions();"><br><br> <img src="./Image/down.png" style="width: 30px; height: 30px;" alt="down" onclick="NextNote('down');"> </td> <td bgcolor="#bce0f8"></td> </tr> <tr><td><img src="./Image/BL-black.PNG" height="19" width="19"></td> <td bgcolor="#bce0f8"></td> <td align="right"><img src="./Image/BR-black.PNG" height="19" width="19"></td></tr> </tbody></table> </body></html> (just started JS 2 weeks ago) -- this is also my first time posting here, if my post isnt following the proper template let me know and Ill fix it .. Thanks so much for taking the time to check this out in advance Im trying to make the first ul tag in the each slideMenus[] array index values have a position of left = 0px I keep recieving this error however ____________________________________________________ Error: slideMenus[i].getElementsByTagName("ul").style is undefined Line: 63 ------------------------------------------------------------------ the script in question is in [code]. Could someone tell me if I am just making a syntax error if not ill try redoing the whole thing. window.onload = makeMenus var currentSlide = null var timeID = null leftPos = 0 function makeMenus(){ var slideMenus = new Array() var allElems = document.getElementsByTagName("*") var slideListArr = new Array() for(var i=0 ; i < allElems.length ; i++){ if(allElems[i].className = "slideMenu") slideMenus.push(allElems[i]) } for(var i=0 ; i < slideMenus.length ; i++){ slideMenus[i].onclick = showSlide; Code: slideMenus[i].getElementsByTagName("ul")[0].style.left = "0px"; } document.getElementById("head").onClick = closeSlide document.getElementById("main").onClick = closeSlide } function showSlide(){ var slideList = this.getElementsByTagName("ul")[0] // mess with this if((currentSlide != null) && (currentSlide.id == slideList.id)) {closeSlide()} else{ closeSlide(); var currentSlide = slideList; currentSlide.style.display = "block"; timeID = setInterval('moveSlide()', 1); } } function closeSlide(){ if(currentSlide){ clearInterval(timeID); currentSlide.style.left = "0px" currentSlide.style.display = "none"; var currentSlide = null } } function moveSlide(){ var leftPos = leftPos + 5; if(leftPos <= 220) {currentSlide.style.left = leftPos + "px"} else{ clearInterval(timeID); var leftPos = 0} } Strange problem here... I'm implementing google's JS tracking code verbatim which determines whether or not the current site is using HTTP or HTTPS. It builds a dynamic URL used as the "SRC" parameter in the SCRIPT statement. On browsers I'm testing with(FF, IE, Chrome) there's no problem running the code. However, there are some people in the office who get an FF or IE error (same versions as mine) on the URL as the SRC parameter. The error, in the FF Error Console, is this: Quote: illegal character http://www.google-analytics.com/ga.js ? ? ? ? --> question marks appear in console I can't figure it out since I can't create this error on any of my browsers. Could this be related to something like browser security settings or add-ons? Hi guys! My first post here! I was encountering a rather confusing error using the webinterface of the DVBViewer Recording Service. Unfortunately the author of this software passed away more than a year ago, so nobody at the forum have the skills to solve this bug. The webinterface has a timeline view of a TV EPG. There are two buttons that navigates back and forth in EPG time. The upcoming DST change on sunday 26th October has revealed a bug. There is no way to navigate passed sunday with the button. Pressing repatedly on the button trying to get mondays EPG. sundays EPG reloads after each button press. Its stuck so to say. I therefor wonder if anyone in here would feel like helping out? The current Recording Service developer pinpointed the error here in the timeline.js: Code: Line 42: var ONE_DAY = 24*60*60*1000; Line 686: /** * increments or decrements the date in the datepicker by the given amount */ function moveDate(offset) { var currDate = datefield.datepicker("getDate"); currDate.setTime(currDate.getTime() + offset * ONE_DAY); var now = new Date().getTime(); if (currDate.getTime() + 2*ONE_DAY < now || currDate.getTime() - 31*ONE_DAY > now) { return; } datefield.datepicker("setDate", currDate); guiactionform.submit(); } Line 1298: $('#nextday').click(function() { moveDate(+1); }); Unfortunately the timeline.js is too large to post in code box so i try to append it as a file: timeline.zip Best regards majstang Why is there a syntax error in this and how do i fix? Code: $(document).ready(function() { $("#gogo").click(function() { $("#replace").html(" <tr> <td width='800' height='186' align='left' valign='top' class='end'> <h1><a href='register.php'><br /> </a></h1> <h1>About Chef Match</h1> <p class='txt' id='more'>Chef Match is a revolutionary site which creates the link between staff and tempory work. Remember this site is not only aimed at chefs, but at anyone who works in a catering environment, waiters, bar staff and even kitchen porters.</p> <p class='txt'> </p> <p class='txt'>Chef Match is a revolutionary site which creates the link between staff and temporary work. Remember this site is not only aimed at chefs, but at anyone who works in a catering environment, waiters, bar staff and even kitchen porters.</p> <p><span class='txt'>Chef Match is a revolutionary site which creates the link between staff and tempory work. Remember this site is not only aimed at chefs, but at anyone who works in a catering environment, waiters, bar staff and even kitchen porters.</span></p> <p><span class='txt'>Chef Match is a revolutionary site which creates the link between staff and tempory work. Remember this site is not only aimed at chefs, but at anyone who works in a catering environment, waiters, bar staff and even kitchen porters.</span></p> <p><span class='txt'>Chef Match is a revolutionary site which creates the link between staff and tempory work. Remember this site is not only aimed at chefs, but at anyone who works in a catering environment, waiters, bar staff and even kitchen porters.</span></p> <p><span class='txt'>Chef Match is a revolutionary site which creates the link between staff and tempory work. Remember this site is not only aimed at chefs, but at anyone who works in a catering environment, waiters, bar staff and even kitchen porters.</span></p> <p><span class='txt'>Chef Match is a revolutionary site which creates the link between staff and tempory work. Remember this site is not only aimed at chefs, but at anyone who works in a catering environment, waiters, bar staff and even kitchen porters.</span></p> <p><span class='txt'>Chef Match is a revolutionary site which creates the link between staff and tempory work. Remember this site is not only aimed at chefs, but at anyone who works in a catering environment, waiters, bar staff and even kitchen porters.</span></p> <p><span class='txt'>Chef Match is a revolutionary site which creates the link between staff and tempory work. Remember this site is not only aimed at chefs, but at anyone who works in a catering environment, waiters, bar staff and even kitchen porters.</span></p> <p><span class='txt'>Chef Match is a revolutionary site which creates the link between staff and tempory work. Remember this site is not only aimed at chefs, but at anyone who works in a catering environment, waiters, bar staff and even kitchen porters.</span></p> <p><span class='txt'>Chef Match is a revolutionary site which creates the link between staff and tempory work. Remember this site is not only aimed at chefs, but at anyone who works in a catering environment, waiters, bar staff and even kitchen porters.</span></p> <p><span class='txt'>Chef Match is a revolutionary site which creates the link between staff and tempory work. Remember this site is not only aimed at chefs, but at anyone who works in a catering environment, waiters, bar staff and even kitchen porters.</span></p> <p><span class='txt'>Chef Match is a revolutionary site which creates the link between staff and tempory work. Remember this site is not only aimed at chefs, but at anyone who works in a catering environment, waiters, bar staff and even kitchen porters.</span></p> <p> </p></td> </tr> "); }); }); So i keep getting this nan error. I googled the crap out of it but can't find anything that works. This part here works fine: Code: function calBolt() { boltQTY = document.getElementById("boltQTY").value; boltCost=boltQTY * 2.1; boltCost=boltCost.toFixed(2); if (boltCost == 0) { document.getElementById("test").lastChild.nodeValue = "$0.00"; } else { document.getElementById("test").lastChild.nodeValue = "$"+boltCost; } } But when i try to use those variables in this function i keep getting an NAN error. Code: function total(boltCost,nutCost,washCost) { var total= 0; total = parseFloat(boltCost)+parseFloat(nutCost)+parseFloat(washCost); document.getElementById("content").lastChild.nodeValue= total; } At the moment i'm trying to use parsefloat to convert it. No luck. I'm thinking it's something really basic and obvious...i do that a lot. Hello, can anyone tell me why I am getting a NaN error with this code? It works on the computer but when accessing from the Net I am getting NaN errors for total1 and total3? Thank you! showAnswers1() { var score1 = 5; var total1 = 0; for (var i=0;i<2;i++){ if (eval("document.s1.q" + i + "[0].checked") == true) total1 = total1 + score1 + 5; } for (var i=2;i<18;i++) { if (eval("document.s1.q" + i + "[0].checked") == true) total1 = total1 + score1; } document.cookie = total1; document.s1.yes1.value = total1; } function showAnswers2() { var total1 = document.cookie; var score2 = 5; var total2 = 0; var total3 = 0; for (var i=18;i<20;i++){ if (eval("document.s2.q" + i + "[0].checked") == true) total2 = total2 + score2 + 5; } for (var i=20;i<36;i++) { if (eval("document.s2.q" + i + "[0].checked") == true) total2 = total2 + score2; } total1 = total1 -0; total2 = total2 -0; total3 = total1 + total2; document.cookie = total3; document.s2.yes1.value = total1; document.s2.yes2.value = total2; document.s2.yes3.value = total3; } //--></SCRIPT> Hello I am getting an error message on a page that uses Javascript. The error is as follows: Code: Message: 'Class' is undefined Line: 1 Char: 1 Code: 0 URI: http://stevehigham59.7host.com/final...//imageMenu.js The first line in the JS file is: var ImageMenu = new Class({ How could I resolve this error, please? Thanks. Steve SOLUTION: I accidentally used <\ul> instead of </ul> ... IE actually threw a proper error, since \u escapes a unicode string (in hex) --- I have the following section of javascript: Code: jQuery.each($('.prodContent'), function(i, val) { if(!($(this).is(":has(ul.tabs)"))) { jQuery.each($(this).children('.panes:has(.tabdiv)'), function(i, val) { var theList = "<ul class='tabs'>\n"; jQuery.each($(this).children('.tabdiv'), function(i, val) { var theName = $(this).children('.noshow:first').text(); theList += " <li><a href='#'>"+theName+"</a></li>\n"; }); theList += "<\ul>\n"; $(this).before(theList); }); } In firefox and chrome, it takes a series of divs, containing headers, and adds a list of those headers before the series... so this: Code: <div> <h2>header1</h2> content </div> <div> <h2>header2</h2> content </div> becomes: Code: <ul> <li><a href="#">header1</a></li> <li><a href="#">header2</a></li> <div> <h2>header1</h2> content </div> <div> <h2>header2</h2> content </div> however, in IE, the error console claims an error on line 7, at the +=, saying that it expected a hexidecimal value... any ideas? p.s. you can see the issue live here http://bit.ly/oYrNAa (sorry bout the url shortener, but i don't want this topic to show up in a search for the site) am working on a certain project , and there is a part were i have to upload a photo; when i run that part of the code am getting the following error message "The value for the useBean class attribute javazoom.upload.UploadBean is invalid" here is the part of the code <%@ page language="java" import="javazoom.upload.UploadBean*,java.util.*,java.io.*" %> <%@ page language="java" import="javazoom.upload.UploadBean*,java.util.*,java.io.*" %> <%@ page errorPage="ExceptionHandler.jsp" %> <jsp:useBean id="upBean" scope="page" class="javazoom.upload.UploadBean" > <jsp:setProperty name="upBean" property="folderstore" value="<%= directory %>" /> <jsp:setProperty name="upBean" property="parser" value="<%= MultipartFormDataRequest.CFUPARSER %>"/> <jsp:setProperty name="upBean" property="parsertmpdir" value="<%= tmpdirectory %>"/> <jsp:setProperty name="upBean" property="filesizelimit" value="8589934592"/> <jsp:setProperty name="upBean" property="overwrite" value="<%= allowoverwrite %>"/> <jsp:setProperty name="upBean" property="dump" value="true"/> </jsp:useBean> PLEASE HELP!!!!! On my blog, www.finkfinance.com, it loads but with the filing Javascript error: --- Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; MDDS; InfoPath.2; .NET CLR 3.5.30729; .NET CLR 3.0.30729) Timestamp: Tue, 6 Oct 2009 20:30:42 UTC Message: 'offsetParent' is null or not an object Line: 44 Char: 3 Code: 0 URI: http://www.finkfinance.com/wp-conten...tepcarousel.js --- Does anyone know how I can fix this? I'm not a web coder and I'm lost when I open up the stepcaraousel.js file. 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?) Hey guys im attempting to write a program based on the following question. The complier keeps hanging up on me with "Discounts.java:32: variable totaldiscount might not have been initialized totalprice= ((purchasecost * totaldiscount)-purchasecost);" the question is as follows; A software company sells a package that retails for $99. Quantity discounts are given as follows: 10-19 = 20% discount 20-49 = 30% 50-99 = 40% 100+ = 50% Write a program that asks the user to enter the number of packages purchased. the program should then display the amount of discount (if any) and the total amount of purchase after the discount. Code: import javax.swing.*; import java.util.*; public class Discounts { //Name: J ***** // Purpose: To provide an accurate discount cost public static void main (String[] args) { double totalpurchases; double totaldiscount; double purchasecost=99; double totalprice; Scanner keyboard = new Scanner(System.in); System.out.println("Please enter your total number of purchases"); totalpurchases = keyboard.nextInt(); if (totalpurchases == 10-19) { totaldiscount = .2; } else if (totalpurchases == 20-49){ totaldiscount = .3; } else if (totalpurchases == 50-99) { totaldiscount = .4; } else if (totalpurchases > 100) { totaldiscount = .5; } else if (totalpurchases <10) { totaldiscount = 0; } System.out.println("Please enter your purchase cost"); purchasecost = keyboard.nextInt(); totalprice= ((purchasecost * totaldiscount)-purchasecost); System.out.println("Your total cost is" + totalprice); } }//end main method // end class |