PDA

View Full Version : Resolved doctype problem in firefox



emanuelle
05-19-2009, 09:55 PM
http://www.alexis-html.com/test.html

it works perfect in IE7 but not in FF3
if i change the doctype to:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> then it works in firefox but in IE all my design falls apart
it has to be in
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

so what do i have to fix to the code so it works with xhtml1-transitional doctype in both browsers???

rangana
05-20-2009, 01:07 AM
First, you need to change highlighted with: type="text/javascript" as it's deprecated:


<script language="JavaScript">


The problem is not on the doctype, but on your script.

You need not to use "eval()" if you want to get the element's ID prefixed with TR and the passed argument.

You can always use "document.getElementById()" and concatenate "tr" with the passed argument.

Migh help:


function disp1(id) {
var ObjDisplay = document.getElementById("tr"+id);
for (i=1;i<5;i++) {
document.getElementById("tr"+i).style.display="none";
}
ObjDisplay.style.display="block";
}

emanuelle
05-20-2009, 04:36 AM
it still doesnt work in firefox

<script language="JavaScript">
function disp1(id) {
var ObjDisplay = document.getElementById("tr"+id);
for (i=1;i<5;i++) {
document.getElementById("tr"+i).style.display="none";
}
ObjDisplay.style.display="block";
}
</script>

rangana
05-20-2009, 04:41 AM
It works fine on my end, please script the code on your live URL.

emanuelle
05-20-2009, 05:44 AM
oops sorry
thank you so much for your help!!