RE: DOCTYPE, javascript and Firefox

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----Original Message-----
From: Andrew Ballard [mailto:aballard@xxxxxxxxx] 
Sent: 30 October 2008 05:15 PM
To: arno@xxxxxxxxxxxxxx
Cc: PHP - General
Subject: Re:  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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux