Forum Moderators: open
When I add the DOCTYPE, ajax is not working in Mozilla firefox though it works in Internet Explorer. What can be done in this case? I just want to make my code w3c compliant.
This code works fine (in both IE and firefox):
<html>
<head>
<title><?php echo $title;?></title>
<meta name="robots" content="all,index,follow"/>
<meta name="description" content="<?php echo $description;?>"/>
<meta name="keywords" content="<?php echo $keywords;?>"/>
<meta name="classification" content="hotels,resorts"/>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<style type="text/css">
<!--
body {
background-color: #666666;
margin:0;
padding:0;
}
-->
</style>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
..........
But this code does not work in firefox but works in IE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php echo $title;?></title>
<meta name="robots" content="all,index,follow"/>
<meta name="description" content="<?php echo $description;?>"/>
<meta name="keywords" content="<?php echo $keywords;?>"/>
<meta name="classification" content="hotels,resorts"/>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<style type="text/css">
<!--
body {
background-color: #666666;
margin:0;
padding:0;
}
-->
</style>
<link href="style.css" rel="stylesheet" type="text/css"/>
</head>
..........
What can be done in this case? I just want to make my code w3c compliant.
How do you know it is not compliant? If you tested it against the validator [validator.w3.org], what did it tell you?
I would start there.
Errors:
Line 1, Column 0: no document type declaration; implying "<!DOCTYPE HTML SYSTEM>".
Line 5, Column 252: document type does not allow element "META" here.
Line 6, Column 161: document type does not allow element "META" here.
Line 7, Column 109: document type does not allow element "META" here.
Line 8, Column 71: document type does not allow element "META" here.
Line 9, Column 22: document type does not allow element "STYLE" here.
Line 19, Column 56: document type does not allow element "LINK" here.
Line 56, Column 6: end tag for element "HEAD" which is not open.
Line 57, Column 5: document type does not allow element "BODY" here.
One of the warnings:
Line 4, Column 46: NET-enabling start-tag requires SHORTTAG YES.
You mention that if you leave the DOCTYPE it will indeed validate, but your AJAX won't function properly ... yet you have not shown any JavaScript here at all. The likely issue is that you are using properties or methods in the JavaScript code that are not recognized by the Gecko engine.
I have put here the php code by mistake.I do it the way you have mentioned, that is, by using the resultant html given by the browser.
I sent you a sticky mail yesterday wherein I included the javascript and the actual problem. It seems you have not received it. Please check if you have got my mail or not. Thanks...
<script type="text/javascript">
/*<![CDATA[*/
//...javascript code in here...
/*]]>*/
</script>
As I said, just a shot in the dark...
Once I got everything follwing xhtml rules, the formats I made began to work.
I guess it's because how standardized firefox is.
Maybe look over your entire document for small errors that you could have missed?