Forum Moderators: open

Message Too Old, No Replies

javascript works on firefox, but not in IE

         

Driber

1:31 pm on Aug 3, 2008 (gmt 0)

10+ Year Member



hey guys, can anyone identify why this script works fine on firefox (v.3) but not on IE (v.6)?

in IE, I get this message
Line: 11
Char: 64
Error: Syntax error
Code: 0

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD><TITLE>My Photo Gallery</TITLE></HEAD>
<BODY>
<SCRIPT src="swfobject.js"
type=text/javascript></SCRIPT>

<P id=player1><A
href="http://www.macromedia.com/go/getflashplayer">Get the
Flash Player</A> to see this player.</P>
<SCRIPT type=text/javascript>var s1 = new SWFObject("player.swf","single","425","355","7");<br />
s1.addVariable("file","myvid.flv"); <br />
s1.addVariable("image","myvid.jpg");<br />
s1.addVariable("width","425"); s1.addVariable("height","355"); s1.addVariable("skin","snel.swf"); s1.addVariable("stretching","fill"); s1.write("player1");<br />
</SCRIPT>
</BODY></HTML>

rocknbil

4:23 pm on Aug 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome aboard Driber!

#1 and 2 are not related to your error, it's probably #3.

1. This is an incomplete doctype and will put your document into quirks mode (search this board for more info.)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

A full doctype uses the URL:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
(all on one line)

2. You are using XHTML style tags that are not valid for 4.01: <br /> should be <br>

3. You have HTML inside your script tags which is probably causing the error.

<SCRIPT type=text/javascript>
...<br />
...<br />
...
</SCRIPT>

Remove those and you should be fine.

Driber

4:49 pm on Aug 3, 2008 (gmt 0)

10+ Year Member



Hi rocknbil :)

Great stuff, that indeed did the trick. Thanks!