BenBox
07-31-2006, 01:15 PM
Hey all,
I've got 2 little issues which I'm not sure how to go about.. both being because I'm not familiar with making things compatible outside of IE. The examples I've got below work in IE, but how can I adapt them to work in other browsers, such as FireFox and the like?
This first one is actually CSS.. it works perfectly in IE, and means I don't have to put border="0" on every image.. but doesn't transfer outside of IE..
image {
border: 0 none;
}
This second problem is to do with showing/hiding a navigation table, again.. works in IE but messes up in FireFox.. how can I change this to work universally?
Edit: This does actually work, but there's an issue with the column width remaining the same.. just hiding or showing its contents, is there a way around this?
var browserType;
if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko"}
///////////////////////////////
function toggle_nav(do_show) {
var tbl;
if (browserType == "gecko" )
tbl = document.getElementById('mainTable');
else (browserType == "ie")
tbl = document.all['mainTable'];
// var tbl = document.getElementById('mainTable');
var rows = tbl.getElementsByTagName('tr');
if( do_show == true ) {
var cels = rows[0].getElementsByTagName('td');
cels[0].style.display='none';
cels[1].style.display='block';
}
else {
var cels = rows[0].getElementsByTagName('td');
cels[0].style.display='block';
cels[1].style.display='none';
}
}
Many thanks for any help! :D
I've got 2 little issues which I'm not sure how to go about.. both being because I'm not familiar with making things compatible outside of IE. The examples I've got below work in IE, but how can I adapt them to work in other browsers, such as FireFox and the like?
This first one is actually CSS.. it works perfectly in IE, and means I don't have to put border="0" on every image.. but doesn't transfer outside of IE..
image {
border: 0 none;
}
This second problem is to do with showing/hiding a navigation table, again.. works in IE but messes up in FireFox.. how can I change this to work universally?
Edit: This does actually work, but there's an issue with the column width remaining the same.. just hiding or showing its contents, is there a way around this?
var browserType;
if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko"}
///////////////////////////////
function toggle_nav(do_show) {
var tbl;
if (browserType == "gecko" )
tbl = document.getElementById('mainTable');
else (browserType == "ie")
tbl = document.all['mainTable'];
// var tbl = document.getElementById('mainTable');
var rows = tbl.getElementsByTagName('tr');
if( do_show == true ) {
var cels = rows[0].getElementsByTagName('td');
cels[0].style.display='none';
cels[1].style.display='block';
}
else {
var cels = rows[0].getElementsByTagName('td');
cels[0].style.display='block';
cels[1].style.display='none';
}
}
Many thanks for any help! :D