...

View Full Version : Is it possible to shorten this script at all



Crash1hd
01-20-2003, 08:52 AM
I have made a script that is cross browser compatable but I was wondering if there was any way of shortening it more then I already have if not please let me know also


function HideShow(){
//if(!ns && !ie && !w3) return; needed for netscape? dont know why
if(!ns && !ie && !w3) return;

AObj=eval(doc + 'A' + sty);AObj.visibility ="hidden";
BObj=eval(doc + 'B' + sty);BObj.visibility ="hidden";
CObj=eval(doc + 'C' + sty);CObj.visibility ="hidden";
DObj=eval(doc + 'D' + sty);DObj.visibility ="hidden";
EObj=eval(doc + 'E' + sty);EObj.visibility ="hidden";
FObj=eval(doc + 'F' + sty);FObj.visibility ="hidden";
GObj=eval(doc + 'G' + sty);GObj.visibility ="hidden";
HObj=eval(doc + 'H' + sty);HObj.visibility ="hidden";
IObj=eval(doc + 'I' + sty);IObj.visibility ="hidden";
JObj=eval(doc + 'J' + sty);JObj.visibility ="hidden";
KObj=eval(doc + 'K' + sty);KObj.visibility ="hidden";
LObj=eval(doc + 'L' + sty);LObj.visibility ="hidden";
MObj=eval(doc + 'M' + sty);MObj.visibility ="hidden";
NObj=eval(doc + 'N' + sty);NObj.visibility ="hidden";
OObj=eval(doc + 'O' + sty);OObj.visibility ="hidden";
PObj=eval(doc + 'P' + sty);PObj.visibility ="hidden";
QObj=eval(doc + 'Q' + sty);QObj.visibility ="hidden";
RObj=eval(doc + 'R' + sty);RObj.visibility ="hidden";
SObj=eval(doc + 'S' + sty);SObj.visibility ="hidden";
TObj=eval(doc + 'T' + sty);TObj.visibility ="hidden";
UObj=eval(doc + 'U' + sty);UObj.visibility ="hidden";
VObj=eval(doc + 'V' + sty);VObj.visibility ="hidden";
WObj=eval(doc + 'W' + sty);WObj.visibility ="hidden";
XObj=eval(doc + 'X' + sty);XObj.visibility ="hidden";
YObj=eval(doc + 'Y' + sty);YObj.visibility ="hidden";
ZObj=eval(doc + 'Z' + sty);ZObj.visibility ="hidden";
}

onload=HideShow ;
//End-->

and of course the link and div tags to be equivilent to above like the one example like below

<a href="#" onMouseover="Javascript:HideShow();AObj.visibility='visible';">A</a>

<div id="A" style="position:absolute;visibility:hidden">A</div>

Borgtex
01-20-2003, 10:58 AM
function HideShow()
{
if(!ns && !ie && !w3) return;
for (t=65;t<91;t++)
{eval(doc + String.fromCharCode(t) + sty+'.visibility ="hidden"');}
}

beetle
01-20-2003, 11:30 PM
Not using eval
function HideShow()
{
if(!ns && !ie && !w3) return;
for (t=65;t<91;t++)
{
document.getElementById( String.fromCharCode( t ) ).style.visibility = 'hidden';
}
}All the text in this post that is bold red has been brought to you by: Borgtex and the letter i ;)

Borgtex
01-21-2003, 12:49 AM
hummm... somebody has a visibility problem, beetle (visbility) ;)

beetle
01-21-2003, 01:51 AM
Originally posted by Borgtex
hummm... somebody has a visibility problem, beetle (visbility) ;) Hehe, ooops. :rolleyes:

whammy
01-21-2003, 02:38 AM
LOL... don't you love typos? I've made some really funny ones. ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum