Working with div tags
4 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Daniel_Baylon
Posted On:   Thursday, January 23, 2003 09:33 AM

Does somebody know how to show / hide tags using Netscape Navigator? I found following code, but works only on Internet Explorer. I appreciate some help. Best Regards function showPage(pDiv){    if (document.layers)       document.layers[pDiv].visibility = "show";    else if (document.all)       document.all[pDiv].style.visibility = "visible"; } function hidePage(pDiv){    if (document.layers)       document.layers[pDiv].visibility = "hide";    else    More>>

Does somebody know how to show / hide tags using Netscape Navigator?



I found following code, but works only on Internet Explorer.



I appreciate some help.



Best Regards





function showPage(pDiv){

  
if (document.layers)

     
document.layers[pDiv].visibility = "show";

  
else if (document.all)

     
document.all[pDiv].style.visibility = "visible";

}



function hidePage(pDiv){

  
if (document.layers)

     
document.layers[pDiv].visibility = "hide";

  
else if (document.all)

     
document.all[pDiv].style.visibility = "hidden";

}


   <<Less

Re: Working with div tags

Posted By:   Nitesh_Naveen  
Posted On:   Friday, January 24, 2003 04:05 AM

As Fyrat rightly pointed out the problem in Netscape is the position attribute should eb specified... Teh funciton however can be used like this for implementing new browsers too and better options...

function swapPageVisibility(divId,flag){
if (document.getElementById)
document.getElementById(divId).style.visibility = flag?"visible":"hidden";
else if (document.all)
document.all[divId].style.visibility = flag?"visible":"hidden";
else if (document.layers)
document.layers[divId].visibility = flag?"show":"hide";
}

where the flag denotes whether to show or not(ie hide).

Re: Working with div tags

Posted By:   gadabout_g  
Posted On:   Friday, January 24, 2003 02:21 AM

Try this link:

http://www.the-cool-place.co.uk/javascript/tutorial/javascript1.html

This might help you

Best of luck!

Re: Working with div tags

Posted By:   Firat_Tiryaki  
Posted On:   Thursday, January 23, 2003 11:18 AM

If you have nested divs, you have to take care about netscape coding. Netscape notifies the nested divs as new documents. Below code shows how to refer to visibility property of an inner div from an outer



document.layers['outerDivName'].document.layers['innerDivName'].visibility;

Re: Working with div tags

Posted By:   Firat_Tiryaki  
Posted On:   Thursday, January 23, 2003 11:11 AM

Well it should work, but maybe you have some different html coding, probably your div is in a div too. (I mean you used nested divs maybe). please send your html code.
About | Sitemap | Contact