Going a little OT on your post here, sorry, but there is a easy way
to do add very good cross browser compatibility if you want to.
Wednesday, August 14, 2002, 8:38:53 AM, you wrote:
F> NS4 = (document.layers) ? 1 : 0;
F> IE4 = (document.all) ? 1 : 0;
F> ver4 = (NS4 || IE4) ? 1 : 0;
You have NS4/IE handled, but are locking out Mozilla and Opera, which
can handle this code just fine. Adding one line will gain you a lot of
compatibility.
var ie = document.all? true : false;
var ns4 = document.layers? true : false;
var dom = document.getElementById && !document.all ? true : false;
The dom var covers any browser that supports the w3c dom, including
IE5.5+, Mozilla, and Opera 6. doc.all has advantages in IE though, so
I still use it there.
F> function popUp(boxName,on) {
F> if (on) {
F> if (NS4) {
F> document.layers[boxName].visibility = "show";
F> } else {
F> document.all[boxName].style.visibility = "visible";
F> }
F> } else {
F> if (NS4) {
F> document.layers[boxName].visibility = "hide";
F> } else {
F> document.all[boxName].style.visibility = "hidden";
F> }
F> }
F> }
Doing it this way keeps your browser detection out of your display
logic.
function getObject(nameStr) {
if (dom) {
return document.getElementById( nameStr );
}
else if (ie) {
return document.all[nameStr];
}
else if (ns4) {
return document.layers[nameStr];
}
}
function popUp(boxName,on) {
objLayer = getObject(boxName);
if (on)
objLayer.style.visibility = "show";
else
objLayer.style.visibility = "display";
}
If you are going to lock out anyone...do it to those NS4 users ;-)
--
jon
______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists