Forum Moderators: open

Message Too Old, No Replies

Doctype change creates Javascript errors

Doctype problem...

         

john1000

9:50 pm on Jul 26, 2006 (gmt 0)

10+ Year Member



Hello,

the story....

im making a theme (phpnuke) and ive run into a doctype problem .
im using curvy Corners and all seems to be fine in firefox but IE is not satisfied with doctype:
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">

thats the standard one..
all works but in IE the top isnt well closed around corners...
you see a tiny stripe..

so to solve that (as author said) was to replace the doctype with this one:
<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" "http://www.w3.org/TR/html4/loose.dtd">

so that works..
but with that another problem rises..
i have a shop installed and in its admin area it uses collapsable menu's.

but with the changing of the doctype that doesnt work anymore.
in firefox (developper plugin) it shows :

document.all has no properties

and that part :

<script>
function showblock(obj) {
eval("document.all." + obj + ".style.display='block'");
}
function clearblock(obj) {
eval("document.all." + obj + ".style.display='none'");
}
</script>

anyway to solve this?
Its like or use the one or the other...

Robin_reala

11:23 pm on Jul 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This should fix it.

<script type="text/javascript">
function showblock(obj) {
document.getElementById('obj').style.display='block';
}
function clearblock(obj) {
document.getElementById('obj').style.display='none';
}
</script>

document.all hasn't been needed since IE4.

john1000

3:15 pm on Jul 27, 2006 (gmt 0)

10+ Year Member



thank you,ill give that a try.. :)

penders

7:35 am on Jul 28, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi John, just to note, the reason for your visual differences between FF and IE in the beginning using the doctype:

<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">

is because this is not a valid HTML 4.01 doctype, you need the full URI as you have in your second doctype example. IE reverts to rendering the page in Quirks Mode, not Strict Mode in this case.

----

Q. Just a query... what are the '\' (backslashes) for in the doctype you give? It looks like you are escaping the first set of double quotes?

...PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"...