JavaScript - Firebug Prevents Page Interaction
Hey all,
Whenever firebug detects a js error on a page, it prevents you from interacting with the page, so you can't scroll, you can't click, you can't do anything except close the window. Anyway around this? Thanks. Similar TutorialsPlease advise me: I've successfully called a variety of functions that have no parameter value such as: function expand() //expand() in this line is merely an example But I'm unsuccessful calling a function with a paramter value such as: function expand(id) Here is the the call line: document.addEventListener("DOMContentLoaded", expand(id) , false); Here is the Function: function expand(id) { for (var i = 1; i<=10; i++) { if (document.getElementById('smenu'+i)) { document.getElementById('smenu'+i).style.display='none'; } } if (id) { id.style.display='block'; } } I've got the following problem. In IE if a contenteditable element is nested inside a hyperlink, clicking on the element prevents the hyperlink default behavior, i.e. navigation to another document. In FF it works fine. How can I solve the problem? Just removing the contentEditable attribute is not a solution since I want this behavior (navigation to another document) only when user clicks the content-editable element with pressed Ctrl key. Thanks. 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 I am trying to debug this with FireBug Code: function chapter12_nodeOne() { //create an element var element = document.createElement('input'); //set some attributes element.setAttribute('type', 'button'); element.setAttribute('value', 'submit'); //appendd the element into a DIV document.getElementById('myDiv').appendChild(element); //uses EventUtil to attach an event listener (1) EventUtil.addHandler(element, 'click', function() { alert('added event handler') }); } var EventUtil = { (2)addHandler: function(element, type, handler) { //check if the element and the browser support DOM Level 2 event attachment //if the user is not browsing with IE if (element.addEventListener) { element.addEventListener(type, handler, false); } //if user is browsing with IE else if (element.attachEvent) { element.attachEvent("on" + type, handler); } //if user is using a browser that only supports DOM Level 0 event attachment else { element["on" + type] = handler; } }, removeHandler: function(element, type, handler) { //check if the element and the browser support DOM Level 2 event attachment //if the user is not browsing with IE if (element.removeEventListener) { element.removeEventListener(type, handler, false); } //if user is browsing with IE else if (element.detachEvent) { element.detachEvent("on" + type, handler); } //if user is using a browser that only supports DOM Level 0 event attachment else { element["on" + type] = null; } }, preventDefault: function(event) { if(event.preventDefault) { event.preventDefault(); } else { event.returnValue = false; } } }; I put a breakpoint on the line marked with (1), I am trying to go to line (2) with all the available options FireBug gives, but unfortunately I get the end of chapter12_nodeOne function. Any ideas why? <!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" lang="en" xml:lang="en" > <title>Assignment 4 - JavaScript Conditional Variables</title> <head> <script type="text/javascript"> alert("Browser"+"\n\n"+navigator.appName); student = confirm("Are you student at Silicon ?"); if(student==true){ alert("please enter your marks"); } else{ alert("please register first"); location.href="Registration.html"; } function getGrade(){ if((Number(document.form1.input1.value)>90) && (Number(document.form1.input1.value)<100)) { alert("Grade A"); } else if((Number(document.form1.input1.value)>80) && (Number(document.form1.input1.value)<90)) { alert("Grade B"); } else if((Number(document.form1.input1.value)>70) && (Number(document.form1.input1.value)<80)) { alert("Grade C"); } else if((Number(document.form1.input1.value)>60) && (Number(document.form1.input1.value)<70)) { alert("Grade D"); } else if((Number(document.form1.input1.value)>50) && (Number(document.form1.input1.value)<60)) { alert("Grade F"); } else if(Number(document.form1.input1.value)<50) { alert("Grade G"); } } function identifyKey(evt){ evt = evt || window.event; if(navigator.appName==/*Internet Explorer*/){ var charCode = evt.keyCode; } else{ var charCode = evt.which; } alert(charCode); } </script> <style type="text/css"> #main{ margin:auto; width:70%; } #top{ font-size:20px; font-weight:bolder; color:#007700; text-decoration:underline; } #s1{ font-size:20px; font-weight:bold; color:#7700ff; } #s2{ font-size:20px; font-weight:bold; color:#00ff00; } #s3{ font-size:20px; font-weight:bold; color:#ff0000; } #form1{ width:600px; height:80px; padding:20px; background-color:#aaaaaa; } </style> </head> <body> <div id="main"> <p id="top">Assignment 4 - JavaScript Conditional Variables</p> <span id=s1>This is Form for checking Grade</span> <form id=form1 name=form1> <table> <tr><td>Enter Marks </td><td>: <input type="text" name="input1" onkeypress=identifyKey(event) /></td></tr> <tr><td><input type="button" name=btn1 value="Get Grade" onclick=getGrade() /></td></tr> </table> </form> </div> </body> </html> When I try to check whats wrong with this script in Firebug, I get error Quote: No Javascript on this page If <script> tags have a "type" attribute it should equal "text/javascript" or "application/javascript" Why am I getting such an error in Firebug. I understand there is some syntax error in this script How can I check whats wrong if I am getting such a message in Firebug ? Thanks Ok so I'm playing around with writing scripts reading through JavaScript: The Definitive Guide and I'm on the Section "Relationships Between Frames". All i'm trying to do is change the background color of the <div id=iframewrap> element, which is inside the iframe, by clicking on the paragraph that says "Click Me", which is inside the iframe's parent window. I have everything I tried below along with the error message recieved by firebug. I Cant figure it out. HTML Code: <p>Click below to change the style of the iframe</p> <p style="color:blue" onClick="chngFrameStyle()">Click Me</p> <iframe id="fone" name="fone" src="OreillyCh14v2Iframe.html" width="50%" height="400px" ></iframe> The iframe Code: <div id="iframewrap" > <h1>Iframe Window</h1> <div id="iframeparagraph"><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa <strong>strong</strong>. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede <a class="external ext" href="#">link</a> mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi.</p></div> </div> JavaScript Code: function chngFrameStyle() { /* var frameone = window.frames['fone']; frameone.document.getElementByID("iframewrap").style.backgroundColor = "#444"; frameone.document.getElementByID("iframewrap").style.color = "white"; Didn't Work :-{ Firebug Error: frameone.document.getElementByID is not a function */ /* window.frames[0].document.getElementByID("iframewrap").style.backgroundColor = "#444"; window.frames[0].document.getElementByID("iframewrap").style.color = "white"; Didn't Work :-{ Firebug Error: window.frames[0].document.getElementByID is not a function */ /* var iframeone = document.getElementById("fone"); iframeone.document.getElementByID("iframewrap").style.backgroundColor = "#444"; iframeone.document.getElementByID("iframewrap").style.color = "white"; Didn't Work :-{ Firebug Error: iframeone.document is undefined */ /* frames[0].iframewrap.style.color = "white"; return; Didn't Work :-{ Firebug Error: frames[0].iframewrap is undefined */ }; I'm getting an '$active is not defined' error, which makes sense because the method that defines it isn't called till 10 seconds after I check if it is defined below. But that's the point. I'm actually checking to see if it is defined, and if it's not, then I defined. However, firebug still gives me the error for this: Code: if ($active == undefined) { $active = $('.paging a.active'); } var triggerID = $active.attr("rel") - 1; var image_reelPosition = triggerID * imageWidth; I also tried: if ($active === undefined) if (!$active) But nothing works. I'm just trying to check if it's not defined, then define it. Yet it won't let me check if it is undefined because it is telling me it's undefined despite the fact I'm checking for that very reason. Thanks for any response. Hello. I'm coding a simple hover-opacity thing for some images on my site on the navigation bar. Although I'm receiving this message in my Firebug. uncaught exception: Syntax error, unrecognized expression: . Here's the navigation code: Code: <div class="navigation"> <a href="home"><img class="home" src="images/navigation/home.gif" /></a> - <a href="home" class="home">Home</a> <a href="news"><img class="news" src="images/navigation/news.gif" /></a> - <a href="news" class="news">News</a> </div> So the effect I've made is, when I hover the image, its opacity gets set to 1. And when I move my mouse away the image changes opacity to .5 And when I hover the text "Home" or "News" the same effect happens with the image. And here's my jQuery: Code: $(function(){ $('.navigation img').css({ opacity: .5 }); $('.navigation img').hover(function(){ $(this).stop().animate({ opacity: 1 },300); }, function(){ $(this).stop().animate({ opacity: .5 },300); }); $('.navigation a').hover(function(){ var imageClass = $(this).attr('class'); $('.navigation img.' + imageClass).stop().animate({ opacity: 1 }, 300); }, function(){ var imageClass = $(this).attr('class'); $('.navigation img.' + imageClass).stop().animate({ opacity: .5 }, 300); }); }); I can't seem to find the error in my script(s). Any help is appreciated. EDIT: Apparently the error appears when I make anchor tags around the image. Code: <a href="home"><img ... /></a> This gives the error. :S Code: <img ... /> But this doesn't? How can this be? Hey all, Firebug gives me the below error message: component.singularize is not a function [Break on this error] var component = component.singularize(); This is what I have: Code: var component = window.location.hash.replace('#', ''); var component = component.singularize(); alert("The component name is " + component); var singularize = function(){ if(!String.prototype.singularize){ String.prototype.singularize = function(){ var context = this; result = ((context.charAt(context.length -1, 1) == 's') ? context.substring(0, context.length - 1) : context); return result; } } } Thanks for any response. I need to interact with application in a way that is being used by mouse and some keyboard clicking like save a text file to a desired location with a desired name by the java script file. Can you give me some information how to do that, and where to get information for that?
Is it possible to use GetVariable() on a variable outside the Main scene timeline? Im trying to get a variable that is set on "sprite 479" that is gonna run on frame #2.. the variable name is "myVariable" Code: function getElement() { var FlashArr = document.getElementsByName('myFlash'); return FlashArr[FlashArr.length-1]; } alert(getElement().GetVariable("myVariable")); I can only get variables located on the MainMovie sprite. Thank you. Hi, I have this web browser which opens up a website that has a drop down list showing values that the user can select. And when I the firebug to inspect the elements in the page, what shows in the inspection window is this: Code: <select id="instance2" name="instance2"> <option value="0">All instances</option> <option value="1">Item0</option> <option value="2">Item1</option> <option value="3">Item2</option> . . . <option value="23">Item22</option> What I'm supposed to do is to get the values and update them automatically to the database. I'm actually using HtmlUnit to do this project, and I've heard how I can use getElementById() to get the values. But I don't know how to start. I'm a beginner so I might need a lot of help on this matter. Help is kindly appreciated. Thanks. hi, on my site, http://www.jbiddulph.com/john-drag.html when i move the box within the box, the results are only shown when I click on the firebug icon?! Can someone please help me here? I would like the results to be shown OnMouseUP thanks Hello, I am looking for some strong resources about the topics above. I am trying to create a map for my website that visualizes Americas opinions on who will win the 2012 election... Obama vs the Republicans. I have a data set that will be the base, but I would like to update the map as users take the accompanying poll and as the data set changes. Any ideas or information would be awesome! Thanks Hello JavaScripters! I was hoping you could help me with an application I'm working on using C# and the .NET Framework that incorporates Javascript. I'm trying to do something similar to to the FireBug / Firefox Inspect Element featu I came across http://www.selectorgadget.com/ which is exactly what I'm trying to do. It's in Javascript and after looking through the source code for the past 2 hours I still don't have a clue how to incorporate it into my program... From what I can tell it uses tokenizing and recursive analysis of DOM elements to figure out CSS selector paths: http://www.selectorgadget.com/stable/lib/dom.js. Here is what I have so far. The javascript code highlights HTML elements such as a <table> tag and changes the border and background color. Code: document.onmouseover = dohighlight; document.onmouseout = dohighlightoff; var BGCOLOR = "#444444"; var BORDERCOLOR = "#FF0000"; // Highlight <table> in grey function dohighlight() { var elem = window.event.srcElement; while (elem!=null && elem.tagName!="TABLE") elem = elem.parentElement; if (elem==null) return; if (elem.border==0) { elem.border = 1; // store current values in custom tag attributes // elem.oldcolor = elem.style.backgroundColor; // store backgroundcolor elem.style.backgroundColor = BGCOLOR; // new background color elem.oldbordercolor = elem.style.borderColor; // same with bordercolor elem.style.borderColor = BORDERCOLOR; var rng = document.body.createTextRange(); rng.moveToElementText(elem); // Make a red border around <table> function dohighlightoff() { var elem = window.event.srcElement; while (elem!=null && elem.tagName!="TABLE") elem = elem.parentElement; if (elem==null) return; if (elem.border==1) { elem.border = 0; // recover values from custom tag attribute values elem.style.backgroundColor = elem.oldcolor; elem.style.borderColor = elem.oldbordercolor; } } Any ideas on how to incorporate the Selectorgadget into my program would be greatly appreciated! Selectorgadget Source Code: https://github.com/iterationlabs/selectorgadget <!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" lang="en" xml:lang="en" > <title>Assignment 5 - JavaScript Loops</title> <head> <script type="text/javascript"> function getGrade(){ var i= Number(document.getElementById("input1").value); m=Math.floor(i/2); for(var k=1; k<=i; k++){ for(var j=1; j<=k; j++){ document.write(j+" "); if(j==k){ document.write("\n"); } if(j==i){ decreaseLoop(j, k); } } } function decreaseLoop(j, k){ for(k=k-1; k>0; k--){ for(var l=1; l<=k; l++){ document.write(l+" "); if(l==k){ document.write("\n"); } } } } } </script> <style type="text/css"> #main{ margin:auto; width:70%; } #top{ font-size:20px; font-weight:bolder; color:#007700; text-decoration:underline; } #s1{ font-size:20px; font-weight:bold; color:#7700ff; } #s2{ font-size:20px; font-weight:bold; color:#00ff00; } #s3{ font-size:20px; font-weight:bold; color:#ff0000; } #form1{ width:600px; height:80px; padding:20px; background-color:#aaaaaa; } </style> </head> <body> <div id="main"> <p id="top">Assignment 5 - JavaScript Loops</p> <span id=s1>This is Form for checking Loop</span> <form id=form1 name=form1> <table> <tr><td>Enter Number </td><td>: <input type="text" id=input1 name="input1" /></td></tr> <tr><td><input type="button" name=btn1 value="Get Number" onclick=getGrade() /></td></tr> </table> </form> </div> </body> </html> When I execute this code, on the screen I see all output in one line. Which is not hat I want. But when I see it in Firebug (for firefox)or Developer Tool Bar(for IE) , I see it printed out in pyramid form(as required). So why is this output in one line on screen ? How cn I get it in pyramid form ? Thanks Hey all, For the below code, I'm just trying to create a simple toggle menu for a Table of Contents. However, when page loads, I get document.gelementbyid('sidebar') is null even though it's clearly there and if I move script to below markup, it will also give me a hideElements() is not a function error, even though it clearly is. Code: <script type="text/javascript"> (function(){ var headers = document.getElementById("sidebar").childNodes; for(var i=0; i < headers.length; i++){ hideElements(headers[i]); if(headers[i].nodeName == "h1"){ headers[i].childNodes[0].onclick = function(){ hideElements(headers[i]); this.parentNode.nextSibling.style.display = "block"; return false; } } } var hideElements = function(element){ if(element.nodeName == "UL") element.style.display = "none"; } })(); </script> <body> <a name="top"></a> <div id="masthead"> <h1>This is the Help Page</h1> </div> <div id="sidebar"> <h1><a href="chapter1"> Info</a></h1> <ul> <li><a href="#section1">Section 1</a></li> <li><a href="#section2">Section 2</a></li> <li><a href="#section3">Section 3</a></li> </ul> <h1><a href="chapter2"> Info</a></h1> <ul> <li><a href="#section4">Section 4</a></li> <li><a href="#section5">Section 5</a></li> <li><a href="#section6">Section 6</a></li> </ul> </div> <div id="content"> <h1 id="section1">Section 1</h1> <p> </p> <a href="#top">Back to Top</a> <h1 id="section2">Section 2</h1> <p> </p> <a href="#top">Back to Top</a> <h1 id="section3">Section 3</h1> <p> </p> <a href="#top">Back to Top</a> </div> </body> Thanks for any response. help me! im have 2 file .js file 1.js code: document.write("<script src=2.js></script>") document.write(f) file 2.js code: var f="hello" im want run 1.js get variable of file 2.js by 3.html but don't run! code 3.html <script src=1.js></script> Hello. My goal is to load the JS for a specific element before displaying that element. I integrated a third part script, and it works well. I set the timer he The JS is in my heading as <script type="text/javascript" src="countdownpro.js"></script> About mid-body I have: <span id="countdown1">2010-07-20 00:00:00 GMT+00:00</span> which allows for the setting of a target date to countdown to. When the page first loads it shows the above long format target time, until the js/meta tags kick in to modify it to just show the actual countdown as 00:00:00. I have attached countdownpro.js to this post. I tried shifting the function CD_Init() to the top of the script, and also appended it inline with the .html. I tried setting the big external script to "defer", but neither arrangement worked. I also tried placing the src file right at the top. I appreciate your help. I want to implement a javascript function where a submit button will be submitted from the parent page each time I close a child page. Please let me know what I did wrong in my code and please elaborate your answer so that I could understand it better. Thank you so much for your help. I have the following jscript code but it is now working. Code: window.onunload = submitParent; function submitParent() { var doc = window.opener.document, theForm = doc.getElementById("finalForm"); theField = doc.getElementById("finalSelected"); theForm.submit(); theField.trigger('click'); } My form from the parent page is as follow. I want my jscript to just click on the submit button once. Code: <form id = "finalForm "name= "finalForm" method="POST" action=""> <input type="Submit" id = "finalSelected" name="finalSelected"/> |