...

View Full Version : test for netscape or ie



treetop
02-03-2004, 09:23 PM
I am looking for a way to test for Netscape 6

if test-for-netscape {
window.frames['external'].setup(links[aNum]);
}
else {
document.external.setup(links[aNum]);
}


These commands will send the values from an array to an iframe, to
display an image and text. This code works for Netscape

window.frames['external'].setup(links[aNum]);


and this code works for IE 6

document.external.setup(links[aNum]);

treetop
02-03-2004, 10:10 PM
I found a cheap way to do it, but would rather use something better.


function showImg(aNum)
{
if (navigator.appName.substring(0, 7) != "Microso"){
window.frames['external'].setup(links[aNum]);}
else {
document.external.setup(links[aNum]);
}
};

JAVAEOC
02-03-2004, 10:37 PM
:)

var IE = document.all?true:false
if(!IE){}
if(IE){}

it works for the most cases but if you want something better go check this out ---> http://www.brothercake.com/scripts/sniffer.php

glenngv
02-04-2004, 07:56 AM
Object detection is better.


if (window.frames['external'] && window.frames['external'].setup) {
window.frames['external'].setup(links[aNum]);
}
else if (document.external && document.external.setup) {
document.external.setup(links[aNum]);
}

treetop
02-04-2004, 03:45 PM
Thank you glenngv, it worked great.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum