FORUMS: list search recent posts

javascript anamolies: mac vs pc

COW Forums : Web Design

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
rob hindleyjavascript anamolies: mac vs pc
by on Apr 9, 2005 at 1:34:12 am

I have been scripting some drop down menus but have found that Safari and IE on a Mac doesn't slide the sub-menus but IE in Windows does. I was of the understanding that the js language was totally cross-platform. Any thoughts/suggestions?


Return to posts index

GordRe: javascript anamolies: mac vs pc
by on Apr 10, 2005 at 1:51:37 pm

Hello Rob.
Firstly, the version of Javascript could be different (1.1 or 1.5 etc..).
Secondly, and more likely, Javascript code manipulates the browsers document object model(DOM).Whilst very similar, no two browsers DOM are exactly the same, meaning that some browsers may not recognise the 'element' your code refers to .eg: code refering to document.layers will be ok on Netscape 4 browsers but will mean nothing to IE.
Thirdly, browser versions for Windows are different from browser versions for the Mac & each will have a few quirks & strange behaviors.

If you really want to write & understand the code rather than search for good cross-browser compatible drop down menus already written, you need to do a search for "Javascript browser compatibility 'strategy' 'techniques' 'help' ...etc"

A common approach is to test for the feature before executing code and if the feature is not detected , supply alternative options using the if syntax.

if(document layers){ .. do this code... document.layers is supported
}
else if(document.getElementById){.. do this code... document.getElementById is supported
}
else { .. some simple static code
}

If you can post your code up on the web I'll have a look.

Hope this helps
Gord





Return to posts index

GordRe: javascript anamolies: mac vs pc
by on Apr 10, 2005 at 1:51:41 pm

Hello Rob.
Firstly, the version of Javascript could be different (1.1 or 1.5 etc..).
Secondly, and more likely, Javascript code manipulates the browsers document object model(DOM).Whilst very similar, no two browsers DOM are exactly the same, meaning that some browsers may not recognise the 'element' your code refers to .eg: code refering to document.layers will be ok on Netscape 4 browsers but will mean nothing to IE.
Thirdly, browser versions for Windows are different from browser versions for the Mac & each will have a few quirks & strange behaviors.

If you really want to write & understand the code rather than search for good cross-browser compatible drop down menus already written, you need to do a search for "Javascript browser compatibility 'strategy' 'techniques' 'help' ...etc"

A common approach is to test for the feature before executing code and if the feature is not detected , supply alternative options using the if syntax.

if(document layers){ .. do this code... document.layers is supported
}
else if(document.getElementById){.. do this code... document.getElementById is supported
}
else { .. some simple static code
}

If you can post your code up on the web I'll have a look.

Hope this helps
Gord





Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]