The sliding animations are sloppy in IE .. worcks great for firefox and chrome toght , it even work acceptably on my android.

Thank you for reding , hope you can help or point me in the right dirrection :).

C_Ankerstjerne
—
2011-10-07T09:25:35Z —
#2

You are using XHTML served as text/html, in which all code is considered PCDATA, and is thus validated by the parser. Since img is not a valid child of script, the page fails validation. If you served your XHTML as application/xml+xhtml, it would create some actual problems. To avoid this, you have two options:

Switch to HTML 4.01 strict. This is by far the best option, since you can't use any of the inherent benefits of XHTML as long as you serve it as text/html anyway, and since you can't serve XHTML as application/xml+xhtml in any version of Internet Explorer below Internet Explorer 9.

This code is just placing comments into the JavaScript that the browser will ignore because they are comments. If you are really using XHTML these comments will not cause the script to be treated as CDATA - you'd need to move the tag outside of the comments for that.

If you are serving the page as HTML then those comments are unnecessary. If you are serving as XHTML then the tag must be there without being commented. To resolve the conflict get the JavaScript out of the HTML and into a separate file where it belings.

claimore22
—
2011-10-07T19:07:24Z —
#5

Thank you very mutch . It's the first time something like this happen for me . I tought using XHTML 1.0 Strict was better then HTML 4.01 strict.What about HTML5 ?. I considered using it but used XHTML 1.0 since i tough that not a lot of browser actually support HTML5.

I always get my JavaScript into an external file when i finish writing it . Guess i'll develop in external file from the beginning from now :). Should put all my JavaScript into 1 file (less HTTP request)?

Thanks both of you

felgall
—
2011-10-07T19:54:47Z —
#6

claimore22 said:

I tought using XHTML 1.0 Strict was better then HTML 4.01 strict.What about HTML5 ?. I considered using it but used XHTML 1.0 since i tough that not a lot of browser actually support HTML5.

IE8 and earlier don't support XHTML at all - they just offer the file for download instead of displaying it. Once those browsers are dead then XHTML 1.0 will become practical. (X)HTML 5 is still in early draft but is basically attempting to reintroduce all the tags that browsers support which were flagged as unnecessary and to be deleted back in 1997. It also adds a number of additional useful tags and attributes. You can use JavaScript to work around some of the tags and attributes not being supported .

claimore22 said:

I always get my JavaScript into an external file when i finish writing it . Guess i'll develop in external file from the beginning from now :). Should put all my JavaScript into 1 file (less HTTP request)?

You don't need to start with the JavaScript in a separate file. You just need to move it there before you try to validate the HTML.

Whether you put all the JS in one file or not depends on how big the scripts are and whether they are needed on all the pages. If a significant fraction of the code is only used on one page then downloading it for all the other pages will be a bigger overhead than the extra request. What makes the biggest difference with load times is moving your JS to the bottom of the page so everything else loads first. Modern browsers can download up to 8 files at a time as long as they are not JS - which always downloads by itself holding up all the other files until it finishes.

claimore22
—
2011-10-07T20:32:15Z —
#7

Thanks everything is working like a charm ... well almost . Jquery animation is slow in IE8 and IE7 but thats to be expected i guess.

C_Ankerstjerne
—
2011-10-08T08:21:58Z —
#8

Stephen: The Javascript comment won't be recognized as a comment in XHTML, because it isn't treated as Javascript at all before the CDATA declaration. In HTML, where the Javascript is treated as a comment, the CDATA is ignored.

felgall
—
2011-10-08T21:07:09Z —
#9

C_Ankerstjerne said:

Stephen: The Javascript comment won't be recognized as a comment in XHTML, because it isn't treated as Javascript at all before the CDATA declaration. In HTML, where the Javascript is treated as a comment, the CDATA is ignored.

It is still messy inappropriate code. Also if you are using a CMS to construct the pages it may be one that strips out comments and then you can end up with all sorts of invalid mess.

The only way guaranteed to work is to only use a CDATA tag (without the comments) for XHTML and not use anything at all for HTML.

OR better yet - just don't jumble (X)HTML and JavaScript together in the same file.

claimore22
—
2011-10-08T21:13:33Z —
#10

I putted the code in a external javascript file and it did the trick whitout having to change the doctype.

C_Ankerstjerne
—
2011-10-08T22:27:37Z —
#11

StephenMy point exactly (which is why I suggested using HTML in the first place). Just one of the reasons why XHTML serves as HTML is a bad thing.