![]() |
Proper DOCTYPE breaks JavaScript in IE9
I've been playing with a simple HTML document which contains JavaScript in
the <HEAD>. It worked fine without proper DOCTYPE, but when I fixed that so it validated, the JavaScript would not run. At first it was also broken in Firefox but I changed the DOCTYPE slightly as recommended on one forum and it worked - but still not in IE9. There's also a somewhat puzzling complaint about a </P> that passed validation in the first instance but not the second. Here's my HTML: http://www.enginuitysystems.com/ForceCalculator1.htm I start as follows: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> <meta http-equiv="Content-Script-Type" content="text/javascript"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" > <TITLE>Force Calculator</TITLE> <SCRIPT type="text/javascript"> //!-- Beginning of JavaScript - And the complaint is here (around line 150): <P> <h2>Torque, Power, and RPM</h2> <!-- </P> --> I referred to the following, but I note that the SCRIPT in the header is an external reference and the inline script is in the BODY. Maybe I'll try that. I haven't done anything with JavaScript (or HTML for that matter) for awhile, so I'm quite rusty. This may be an obvious error but I'm stumped for now. Thanks! Paul www.muttleydog.com |
Re: Proper DOCTYPE breaks JavaScript in IE9
This simpler HTML page works OK in IE9:
http://www.enginuitysystems.com/CalculateJS1.htm But it has 8 errors and 2 warnings. That's a lot for 60 lines of highly expanded HTML. Paul |
Re: Proper DOCTYPE breaks JavaScript in IE9
"P E Schoen" <paul@peschoen.com> wrote in news:jvs98h$iea$1@dont-email.me:
> This simpler HTML page works OK in IE9: > http://www.enginuitysystems.com/CalculateJS1.htm > > But it has 8 errors and 2 warnings. That's a lot for 60 lines of highly > expanded HTML. Yes, that *is* rather a lot. Had you considered fixing them? |
Re: Proper DOCTYPE breaks JavaScript in IE9
"Robert Baer" wrote in message
news:1dWdnQ4fLPeac7zNnZ2dnUVZ_jidnZ2d@posted.local net... > Obviously all 12 or so digits for power and torque are significant and > meaningful... No, of course not. This is just a simple utility and not a polished product. Actually I have added some functionality and cleaned up some stuff, but still there is a problem with IE9: http://www.enginuitysystems.com/EVCalculator.htm Paul |
Re: Proper DOCTYPE breaks JavaScript in IE9
"Doug Miller" wrote in message
news:XnsA0A8DA4ABDF71dougmilmaccom@88.198.244.100. .. > "P E Schoen" <paul@peschoen.com> wrote in news:jvs98h$iea$1@dont-email.me: >> This simpler HTML page works OK in IE9: >> http://www.enginuitysystems.com/CalculateJS1.htm > >> But it has 8 errors and 2 warnings. That's a lot for 60 lines of highly >> expanded HTML. > Yes, that *is* rather a lot. Had you considered fixing them? I can fix the errors by adding a DOCTYPE. But that breaks JavaScript for IE9. Paul |
Re: Proper DOCTYPE breaks JavaScript in IE9 - solved
I found that the keyword const is not allowed in Javascript, although
apparently Firefox and Chrome allow it. The debugger complained about something else and then finally it continued to the const declaration where it reported a syntax error. So many languages. So much inconsistency... Paul |
Re: Proper DOCTYPE breaks JavaScript in IE9 - solved
In article <jvt94g$38c$1@dont-email.me>,
"P E Schoen" <paul@peschoen.com> wrote: > I found that the keyword const is not allowed in Javascript, although > apparently Firefox and Chrome allow it. The debugger complained about > something else and then finally it continued to the const declaration where > it reported a syntax error. > > So many languages. So much inconsistency... No, just the one. I observe that Safari is very forgiving, reporting no errors in the error console. Not only it doesn't mind your consts, it also allows you to do (e.g.): Form1.FormDate.value = EditDate; rather than: document.Form1.FormDate.value = EditDate; or even: document.forms["Form1"].FormDate.value = EditDate; OK, so you took out the consts. What happened then? -- Tim "That excessive bail ought not to be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted" -- Bill of Rights 1689 |
Re: Proper DOCTYPE breaks JavaScript in IE9
"P E Schoen" <paul@peschoen.com> wrote in news:jvt41n$9sh$1@dont-email.me:
> "Doug Miller" wrote in message > news:XnsA0A8DA4ABDF71dougmilmaccom@88.198.244.100. .. > >> "P E Schoen" <paul@peschoen.com> wrote in > news:jvs98h$iea$1@dont-email.me: > >>> This simpler HTML page works OK in IE9: >>> http://www.enginuitysystems.com/CalculateJS1.htm >> >>> But it has 8 errors and 2 warnings. That's a lot for 60 lines of > highly >>> expanded HTML. > >> Yes, that *is* rather a lot. Had you considered fixing them? > > I can fix the errors by adding a DOCTYPE. Really? What DOCTYPE is that? |
Re: Proper DOCTYPE breaks JavaScript in IE9
"Doug Miller" wrote in message
news:XnsA0A958E37BAEEdougmilmaccom@88.198.244.100. .. > "P E Schoen" <paul@peschoen.com> wrote in news:jvt41n$9sh$1@dont-email.me: >> I can fix the errors by adding a DOCTYPE. > Really? What DOCTYPE is that? Almost any DOCTYPE. The validation errors were mostly related to that. But the broken JavaScript was due to other factors that did not affect validation. The problem(s) are fixed now, at least to the point where it works. Thanks, Paul |
Re: Proper DOCTYPE breaks JavaScript in IE9
"P E Schoen" <paul@peschoen.com> wrote in message news:jvs98h$iea$1@dont-email.me... > This simpler HTML page works OK in IE9: > http://www.enginuitysystems.com/CalculateJS1.htm > > But it has 8 errors and 2 warnings. That's a lot for 60 lines of highly > expanded HTML. > > Paul > Not <SCRIPT type="text/javascript"> //!-- Beginning of JavaScript - // - End of JavaScript - --> </SCRIPT> But <SCRIPT type="text/javascript"> <!-- // Beginning of JavaScript - // - End of JavaScript //--> </SCRIPT> Have to be start <!-- to work in IE........ |
| All times are GMT. The time now is 12:21 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.