Tech Support Guy banner

hiding showing divs

1324 Views 3 Replies 2 Participants Last post by  malice
hello i have this script which makes three divs who are hidden appear by clicking each time on a link specified
but i would also like to see any other div disappear since all the divs are placed at the same position

so when i click on the link which makes my div brands appear
i would like to see the divs services and liability disappear
in case they are visible, all divs are by default hidden
heres what i have for brands and services
if i click on the link for services i want the service div to appear and whichever of the other divs which is visible at that moment to disappear.

heres what i got
Status
Not open for further replies.
1 - 3 of 4 Posts
they start out all invisble its kinda like a little subsite inside a site
a div with its own little menu 3 links and when i click on them the hidden divs inside that div with their content become visible

but when i click on brands first and after that on services i need to make the services div appear and make the one thats already visible invisible again thats the part i need to add to my code without having to make a new function.
well ive tried a different fashion can anyone maybe tell me

how to accomplish what i stated in my former post
i dont get into javascript too frequently

i have three divs with each their id
i need locate the objects within the dom first
i would also like to place it in an external file

dont know if this is the right syntax here
any help would be greatly appreciated

function findObj("brands","services","liability")
{
var p, i, foundObj;

if(!theDoc) theDoc = document;
if( (p = theObj.indexOf("?")) > 0 && parent.frames.length)
{
theDoc = parent.frames[theObj.substring(p+1)].document;
theObj = theObj.substring(0,p);
}
if(!(foundObj = theDoc[theObj]) && theDoc.all) foundObj = theDoc.all[theObj];
for (i=0; !foundObj && i < theDoc.forms.length; i++)
foundObj = theDoc.forms[theObj];
for(i=0; !foundObj && theDoc.layers && i < theDoc.layers.length; i++)
foundObj = findObj(theObj,theDoc.layers.document);
if(!foundObj && document.getElementById) foundObj = document.getElementById(theObj);

return foundObj;
}

function showHideLayers(brands,'','show',services,'','hide',liability,'','hide');
{
var i, visStr, obj, args = showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3)
{
if ((obj = findObj(args)) != null)
{
visStr = args[i+2];
if (obj.style)
{
obj = obj.style;
if(visStr == 'show') visStr = 'visible';
else if(visStr == 'hide') visStr = 'hidden';
}
obj.visibility = visStr;
}
}
}
See less See more
1 - 3 of 4 Posts
Status
Not open for further replies.
Top