RE: [PHP] DOCTYPE, javascript and Firefox



-----Original Message-----
From: Andrew Ballard [mailto:aballard@xxxxxxxxx]
Sent: 30 October 2008 05:15 PM
To: arno@xxxxxxxxxxxxxx
Cc: PHP - General
Subject: Re: [PHP] DOCTYPE, javascript and Firefox

The pragmatic approach says that you've already fixed it: just leave
the DOCTYPE out. :-)

I'm not sure what yours should be, but based on the snippet of HTML
you posted, yours should not be HTML 4.01. Since you are closing the
<input/> tags, you should probably be using one of the XHTML DOCTYPEs
(as long as the rest of your markup is consistent). I'm not sure that
would "fix" your issue, though.

As for why your page does that, I'm not really sure. If you leave the
DOCTYPE off the the browser will select the DOCTYPE it wants to use.
Perhaps since you declared the document to be HTML 4.01 Transitional,
Firefox is applying JavaScript rules where you can't refer to an
element in script simply using its ID attribute. You usually have to
use something like:

document.getElementById('autostartlabel').className = 'disable';

Andrew

--

Hi Andrew and Ross, thanks a lot - using getElementById sorted it out. As
for the DOCTYPE the scripts aren't consistent enough yet to use one of the
XHTML DOCTYPEs, but it's work in progress. Maybe starting that process
caused the problem because I remember testing this successfully in FF, the
reason I persevered so long was I knew it once worked.

As a matter of interest is there a way to see what DOCTYPE the browser chose
to use? The browser is obviously smarter than I am in selecting DOCTYPEs so
maybe I should follow its cue.

Thanks to everyone else who kindly responded as well, I really appreciate
it.

Cheers
Arno

.



Relevant Pages

  • Re: xhtml style.left problem
    ... IE6 but not in Firefox when I use a DOCTYPE ... With the doctype in place FireFox is obeying the standards and the CSS ... Change you JavaScript so that it adds px to the end of the value for y ...
    (alt.html)
  • Re: dynamic nav/drop-down...
    ... No Doctype! ... corporate firewall will have no navigation. ... I still dont get why some users disable JavaScript (some corporate firewalls disable JavaScript?? ...
    (comp.infosystems.www.authoring.stylesheets)
  • Re: How Important is it that a Site is HTML Compliant to W3 Standards?
    ... It seems a shame to work towards creating well structured ... So use a Transitional Doctype, or JavaScript. ... a ridiculous suggestion. ...
    (uk.net.web.authoring)
  • Re: [PHP] DOCTYPE, javascript and Firefox
    ... DOCTYPE, javascript and Firefox ... I'm not sure what yours should be, but based on the snippet of HTML ...
    (php.general)
  • What is a DOCTYPE and why is it screwing me up?
    ... I recently downloaded a javascript to use in my website. ... required a DOCTYPE statement be placed before the HTML tag. ... when I insert the DOCTYPE tag my page doesn't look right. ... The page itsself seems to widen and a horizontal scrollbar is always ...
    (microsoft.public.frontpage.client)