I have an animated menu made using JavaScript.
The animation effect works well in all browsers apart from ie6.
Therefore I altered my code for ie6, so that the menu is still functional, but without any flashy effects.
Now I need to serve one JavaScript file to ie6 and a different one to all other browsers. What is the best way achieve this?
I tried this and it worked:
Code HTML4Strict:<script type="text/javascript" src="./js/index.js"></script> <!--[if lt IE 7]> <script type="text/javascript" src="./js/index_ie6.js"></script> <![endif]-->
Is this good practice?
Or, could I do the same thing within the JavaScript file (i.e. write two functions and then execute only one of them, based on which browser the visitor is using)?
Thanks very much in advance.







Bookmarks