Forum Moderators: open

Message Too Old, No Replies

My page works in FireFox but not in IE?

         

g8tuananh

4:41 pm on Nov 29, 2006 (gmt 0)

10+ Year Member



i open my page on Firefox, it display correct.When i open it with IE it doesn't display enything but i view source all source code is show. Then i paste source to validator.w3.org, the result is: passed validation.
here is my source code:
-------------------------------------------------------------
<!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>
example.net
</title>
<script language="javascript" type="text/javascript" src="MyScript.js" />
</head>
<body>
<form name="form1" method="post" action="default.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJ" />
</div>

<div>
<table>
<tr>
<td style="width: 100px">
<img alt="" src="pictures/logo.JPG" /></td>
<td style="width: 100px">
</td>
</tr>
</table>

</div>
<div style="width: 209px; height: 18px">
</div>
</form>
</body>
</html>
-------------------------------------------------------------------
please give me advice. thanks

[edited by: encyclo at 2:24 am (utc) on Nov. 30, 2006]
[edit reason] removed specifics and unnecessary code [/edit]

g8tuananh

5:06 pm on Nov 29, 2006 (gmt 0)

10+ Year Member



sorry every body. I fix it.
we replace this line:
<script language="javascript" type="text/javascript" src="MyScript.js"/>
with:
<script language="javascript" type="text/javascript" src="MyScript.js"></script>

now who can tell me why is it?

penders

8:58 pm on Nov 29, 2006 (gmt 0)

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



>>> "Why is it?"

There is an end tag by definition, which is always required. The <script> tag is not like the <img>, <br> or <meta> tags etc. which do not have a closing tag in HTML, because the <script> tag can itself have content if the SRC attribute is not used. ie.

<script type="text/javascript"> 
window.onload = myFunc;
function myFunc() {
alert('Page has loaded!');
}
</script>

penders

11:10 pm on Nov 29, 2006 (gmt 0)

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



i open my page on Firefox, it display correct. When i open it with IE it doesn't display enything ... validator.w3.org, the result is: passed validation.

Hhhmmm, OK (soz, kinda danced over that last bit on first read)... so who is correct here?! Should you be able to use the minimized closing tag with the <script> element in XHTML ...? Or has the Validator been fooled in this instance? Or is it simply that browser (IE) support is not what it should be?

encyclo

2:34 am on Nov 30, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld g8tuananh! Glad you figured out the problem. :)

Should you be able to use the minimized closing tag with the <script> element in XHTML ...?

The validator is entirely correct in a technical sense (XHTML is XML so you can close empty elements with a slash), but in the real world the browser support (I mean IE) is sketchy at best.

Run this through the validator, for example:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><title>test</title></head><body>
<div />
<ol>
<li>text</li>
<li />
</ol>
<p>text</p>
</body>
</html>

Firefox handles this kind of markup better when serving the file correctly as

application/xhtml+xml
(with the XML parser), but even when served as
text/html
you should see the empty second list item. In IE, this approach is a recipe for disaster... but as we know, IE doesn't support XHTML so it can't be expected to handle markup written in this way. So who now still thinks that XHTML is backwards-compatible with HTML? ;)

Candid India

11:25 am on Dec 5, 2006 (gmt 0)



you might be having a older version of IE first and then you directly switched on to firefox that faces some problems but validations can help you well.