LittleRed
12-02-2003, 03:23 AM
hi
rather than having loads of tests for the user's browser before using later implemented script, is it valid to test directly for the property's existence and then use it?
say I want to use the availWidth property, could I use:
Var my_screen_width = 600;
if (document.screen.availWidth) {
my_screen_width = screen.availWidth;
}
then if the browser doesn't support the availWidth it will happily pass over the if section and the variable stays at the initialised value of 600?
thanks
rather than having loads of tests for the user's browser before using later implemented script, is it valid to test directly for the property's existence and then use it?
say I want to use the availWidth property, could I use:
Var my_screen_width = 600;
if (document.screen.availWidth) {
my_screen_width = screen.availWidth;
}
then if the browser doesn't support the availWidth it will happily pass over the if section and the variable stays at the initialised value of 600?
thanks