I link to my website's menu with the following: <script type="text/javascript" language="javascript" src="Scripts/menu.js"></script> The problem that I have is that the menu is offset a bit to the left when viewed in IE, due to the Menu offset y coordinate. If I change it so that it looks good with IE, then the menu is offset in Firefox to the Right. So, I'm wondering if I can create a separate .js file that has the correct offset y coordinate for IE and then reference that file if the browser is IE or Opera . Thanks in advance for any feed back. The site is www.frontierid.com if it helps. I'm a bit new to this so I hopes this makes sense.
For IE, this is easy. Use a Conditional Comment to call the IE-specific .js file only for IE (this works for calling any document, including a different style sheet). You can even choose which version of IE you want to recognize the different .js file. Wow, I've never used that link until today, and this is the third time today I've used it, twice on IWDN and now once here. Craziness
Instead of using two separate .js files, why not just use one with a conditional statement at the approriate line. Something like this... if (is_ie == true) { y = 4; } else { y = 5; } Code (markup): If it's just one variable we're talking about here, seems kinda redudant to create two seperate files.
Ya, use the conditional statement as suggested by brian394 For Javascript this code might be usefull to you. http://www.w3schools.com/js/js_browser.asp