[thelist] simple Javascript help
Drew Shiel
ashiel at sportsinteraction.com
Mon Nov 4 04:39:01 CST 2002
At 18:40 01/11/2002 +0000, Chris Marsh wrote:
>I was actually just illustrating some x-browser code I have written
>recently that seems to work okay. However, for your application,
>something along the following lines would be much better:
(Code left unsnipped cos it's Monay morning, and it may be too much
trouble to ask people to remember stuff from way back on Friday... :) )
Again, it's working fine in IE (6.0) but not in Netscape (4.75). I've
tried reordering the ifs for browser detection, but it doesn't seem to
work. The error is:
JavaScript Error:
[url],
line 317:
document.Banner has no properties.
Anyone able to dig this out?
>function StyleObject(id) {
> if(document.getElementById) {
> var s = document.getElementById(id).style;
> }
> else if(document.all) {
> var s = document.all[id].style;
> }
> else if(document.layers) {
> var s = document.layers[id];
> }
> return s;
>}
>
>function fnShowHide(param) {
> StyleObject("Banner").visibility = "hidden";
> StyleObject("n").visibility = "hidden";
> StyleObject("All").visibility = "hidden";
> StyleObject("TextLink").visibility = "hidden";
> StyleObject("WebServices").visibility = "hidden";
> StyleObject("Content").visibility = "hidden";
> StyleObject(param).visibility = "visible";
>}
Cheers,
Drew.
Drew Shiel webmaster at swiftpay.com
+353-1-2365705
------------------------------------------------------------------
Swiftpay -- The best way to pay online -- http://www.swiftpay.com
More information about the thelist
mailing list