I have a webpage when it finished on the left bottom there's a warning says:Done, but with errors on the page. I double click it and it told me:
Line:628
Char:100
Error: Expected ')'
Code: 0
URL:.....
I knew Fiddler is a good tool to debug. I download it and try to debug. The line IE told me I just can't find anything that's missing ')'
Can someone tell me how to debug this?
IE may be interpreting line numbers differently than you expect. Firebug is probably a better tool for helping debug this type of problem.
Fiddler is good at capturing what goes across the stream. It's like comparing a hammer and a wrench. Each is the right tool for a specific job.
If using IE8, hit F12 to bring up the debugger. You can start debugging and have it show you exactly where your error is occurring.
The open ( is probably occurring several lines before the missing ).
Related
The case like this :
My code in the console like that. So I found it hard to make a breakpoint
How can I solve this problem?
just use debugger; in your javascript code, then open browser debugger console and trigger the code, so automatically debug pointer will point at your exact position of code.
for more details read
When I upload to dreamhost my page, I can't debug it because javascript appears with no end of line, like this for example:
function fun(){ alert("1");alert("3");if($("#tbTitulo").val()==""){alert("1");return;}}
so it is practically impossible to debug. I tried on firefox and chrome with the same results. I don't know why this is happening. If you could give me some clue I'd really appreciate it.
You can prettify the code in Chrome Developer Tools. The button is the last one on the bottom row on the sources tab (it looks like a pair of curly brackets):
https://stackoverflow.com/a/6318092/1669279
First you have to Beautify, unpack or deobfuscate JavaScript and HTML, make JSON/JSONP readable, etc.
check here
http://jsbeautifier.org/
after that you can insert breakpoint to debug.
I am hesitant to ask yet another "too much recursion" question, but I'm totally lost for ideas.
I am getting a "too much recursion" error during my .ready(), which is unhelpfully occurring:
Very sporadically (ie once a month) for me
Pretty much every other time I have to do a demo using someone else's computer (of course)
On FF, Chrome, IE9 etc, on our dev, prod and test systems
And it's getting trapped deep inside the bowels of jQuery (1.10.2). Specifically, at this line of Sizzle, inside Sizzle.attr.
I've tried to "force" this bug to appear by using low memory VMs, but that doesn't seem to help. I'm stumped as to how to find where this is occurring, since I can't get a stack trace. I've got no minimal example either, since I can't make the bug happen.
The most likely candidate is something like triggering an event inside its handler, but I can't see how that would occur only sometimes, on load?
How can I try and find what is happening?
Any help or tips or links most welcome. If it's useful, I'm using jQuery, jQuery UI, and OpenLayers.
Try looking at a JS stacktrace when it errors to see the call chain - for a recursion problem this should show you what's recursing. You can see this with dev tools in the browser, for example in Firefox use Firebug's 'script' tab and use the 'stack' output tab.
Just noticed you'd said you'd tried to get a stack trace. Try putting a breakpoint at the line you know is bad and looking at the stacktrace to see if/when it seems to be recursing into some function above that line.
We have this fun example of how our EcmaScript/JavaScript Obfuscator works.
We provide links that show the unobfuscated and obfuscated Ecmascript source for a
"dynamic clock". When you press the start button you will see that the clock graphic parts follow your mouse movements and when you stop moving the mouse it forms a ticking circular clock.
See here ...
http://www.semdesigns.com/Products/Obfuscators/ECMAScriptObfuscationExample.html
The issue that both the un-obfuscated and obfuscated code works fine with Internet Explorer but not with FireFox. So what is the difference between EcmaScript for FireFox and Internet Explorer that results in this code working with Internet Explorer but not with FireFox is the question? I have tried this several versions of FireFox including the latest version and all fail.
First place to check is the "Error Console" or your Firebug console - finding it depends on your version of Firefox and whether or not you have Firebug installed.
I immediately found this in the console when trying out your page:
Error: document.getElementById("mzSeconds" + i) is null
Source File: http://www.semdesigns.com/Products/Obfuscators/UnobfuscatedJavaScriptMouseClock.js.txt
Line: 19
Update
Having found the error, and with Dexter and jfriend00 having pointed out why you're getting the error in the first place, we can see that the difference between IE and "all other" browsers in this case is not how they execute EcmaScript, but in how they construct the DOM in the face of HTML errors -- missing closing quotes on attributes in your case. (Though there are script differences those are not relevant here)
Your document.write() would output <div id="mzSeconds0 style="position:..."> which is invalid, leading to another debugging tool: validation.
If CSS rules or Javascript code behave strangely or inconsistently across browsers it's a good idea to validate your HTML (at validator.w3.org) because invalid HTML will be parsed in different ways by different browsers.
Your immediate problem is that you are generating invalid HTML code, appending it to the DOM, and then trying to find it again using document.getElementById.
The offending section is line 100 of UnobfuscatedHTMLPage.html, which contains this line:
document.write('<div id="'+(('mzSeconds'))+i+' style="position:absolute;top:0px;left:0px" width="15" height="15"><font face=Arial size=3 color='+sCol+'><center><b>'+S[i]+'</b></center></font></div>');
You're missing the closing " immediately after id="'+(('mzSeconds'))+i+', which causes the id of the div tag to be processed incorrectly in IE (two wrongs making a right, in this case).
There are a number of similar errors in that section of code - you'll need to fix them all (by debugging your code in Firebug or Chrome Developer tools) before your code will be valid and work in non-IE browsers.
A very simple look in the debug console of any browser that it doesn't work in would show you where the error was (I used Chrome). Then, a look at the DOM would show you why that error occurred. Use your debugging tools to find your problems.
I think the root issue is that when you generate your HTML, you are missing some closing quotes. That creates illegal HTML which different browsers barf on differently.
The first error in your code is triggered because no object with id="mzSeconds0" exists. This is caused because you are missing a closing double quote in this line:
document.write('<div id="'+(('mzSeconds'))+i+' style="position:absolute;top:0px;left:0px" width="15" height="15"><font face=Arial size=3 color='+sCol+'><center><b>'+S[i]+'</b></center></font></div>');
It should be this with the closing double quote at the end of id="mzSeconds0":
document.write('<div id="'+(('mzSeconds'))+i+'" style="position:absolute;top:0px;left:0px" width="15" height="15"><font face=Arial size=3 color='+sCol+'><center><b>'+S[i]+'</b></center></font></div>');
I think the same error exists on most of these types of lines and you will need to fix them all.
Checking a debugger yields: document.getElementById("mzSeconds" + i) is null and also includes line numbers and stack trace which should make fixing your bug easy.
The cause is that you are throwing invalid HTML to the browser which need to try to correct it somehow. Obviously you end up having a different DOM in IE an Firefox.
document.write('<div id="'+(('mzMinutes'))+i+' style="position:absol…
I still don't see the use of obfuscating JavaScript or writing code in your style. Write HTML directly instead of misusing JavaScript to do so. When you need to create content from JavaScript, then use DOM functions instead of document.write. This would have saved you from this bug.
When you are running your code to a debugger (Firebug), you'll find other bug popping up. Please do also have a look at JavaScript strict mode because it would probably save you a lot of time by pointing out bad practices.
This is my first question on this site. I have an issue with Internet explorer. My contact form works fine in Chrome, Safari and FF but not in IE. Here is the link for my form.
Basically the problem(s) are that there is no text in the dropdown select and as a consequence, nobody can send an enquiry via IE. Can someone help me out here?
Other information...
I got the fancy contact form from:
http://tutorialzine.com/2009/09/fancy-contact-form/
There are other smaller issues such as width of the selects are different in various browsers but I only care about the above problem.
Many thanks
There are a couple errors in the code. I would suggest using a javascript debugger. Chrome developer tools has a good one, and
Firebug is good too for Firefox
for Chrome:
Control - Shift - I keys to open Developer Tools
Control - Shift - J to open Developer Tools and bring focus to the Console.
Control - Shift - C to toggle Inspect Element mode
In your code there are missing commas and parenthesis for if statements... though those are not needed by the compiler, it's good practice to always wrap if statements inside commas, and always put semicolon at the end of each row.
For example
$("#contact-form").validationEngine({
inlineValidation: false,
promptPosition: "centerRight",
success : function(){use_ajax=true},
failure : function(){use_ajax=false;}
}) // missing semicolon here
and
{
$.validationEngine.buildPrompt(".jqTransformSelectWrapper","* This field is required","error") // missing semicolon here
return false;
}
Since you are having bad arguments call in the debugger, it's better to write the code the right way, then we can try to understand what's wrong.