RE: [PHP] DOCTYPE, javascript and Firefox
- From: tmboyd1@xxxxxxxx ("Boyd, Todd M.")
- Date: Thu, 30 Oct 2008 10:17:54 -0500
-----Original Message-----that
From: Arno Kuhl [mailto:akuhl@xxxxxxxxxxxx]
Sent: Thursday, October 30, 2008 9:24 AM
To: 'PHP - General'
Subject: RE: [PHP] DOCTYPE, javascript and Firefox
-----Original Message-----
From: tedd [mailto:tedd.sperling@xxxxxxxxx]
Sent: 30 October 2008 03:58 PM
To: arno@xxxxxxxxxxxxxx; 'PHP - General'
Cc: Arno Kuhl
Subject: Re: [PHP] DOCTYPE, javascript and Firefox
At 3:45 PM +0200 10/30/08, Arno Kuhl wrote:
I came across an odd thing with DOCTYPE, javascript and Firefox 3
thehas me stumped. Not exactly a php issue but hoping someone else on
Transitional//EN\"list has seen this before. (At least the script is php, hope that
counts)
I have the following code in my header script:
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01
\"http://www.w3.org/TR/html4/loose.dtd\">\n";disabled=true />"
Elsewhere I have (simplified):
echo "<input type='radio' name='autostart' value='0'"
."onclick=\"autostartlabel.className='disable';"
."article.startdate.disabled=true;\" />No"
."<input type='radio' name='autostart' value='1'"
."onclick=\"autostartlabel.className='normal';"
."article.startdate.disabled=false;\" />"Yes"; ...
echo "<label id='autostartlabel'>Startdate"
."<input type='text' name='startdate' id='startdate'
."</label>";fields
It's simply 2 radio buttons and if "yes" is clicked related form
are enabled, if "no" is clicked they're disabled.defined".
This code works fine in IE, Opera and Chrome, but gives a javascript
error in FF when I click the radio button: "autostartlabel is not
However if I comment out the DOCTYPE line in the header it works fine
in all browsers including FF. (Took ages to narrow it down to the
DOCTYPE.) Does anyone know why, and how to fix it?
Cheers
Arno
Arno:
Wild guess, place this --
<?php header('Content-Type: text/css; charset=UTF-8'); ?>
-- before the DOCTYPE
HTH's,
tedd
--
-------
Hi tedd
Thanks for the suggestion. What it did though was output the html as
text
rather than render the html. At least it's consistent across all
browsers...
I tried changing it to "Content-Type: text/html;" which rendered the
html
but still gave a js error in FF.
Have you tried referencing the "autostartlabel" radio list using
"document.autostartlabel" instead? If that doesn't work, I seem to
remember that the "name" attribute is being phased out of XHTML
altogether. Perhaps Firefox is just a bit more adept at truly following
the DOCTYPE specification?
HTH,
Todd Boyd
Web Programmer
.
- References:
- Re: [PHP] DOCTYPE, javascript and Firefox
- From: tedd
- RE: [PHP] DOCTYPE, javascript and Firefox
- From: "Arno Kuhl"
- Re: [PHP] DOCTYPE, javascript and Firefox
- Prev by Date: Re: [PHP] DOCTYPE, javascript and Firefox
- Next by Date: scale a webpage
- Previous by thread: RE: [PHP] DOCTYPE, javascript and Firefox
- Next by thread: Re: [PHP] DOCTYPE, javascript and Firefox
- Index(es):