Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

Tracy Floyd www.cdnm.com

« Newer Snippets
Older Snippets »
4 total  XML / RSS feed 

Toggle Block Elements

// (Used for expanding and collapsing block elements. Good for hiding divs or expanding the divs for forms.)
// Link: Read more...
// In page:



function toggleLayer(whichLayer) 
{
        if (document.getElementById) 
        {
                // this is the way the standards work
                var style2 = document.getElementById(whichLayer).style;
                style2.display = style2.display? "":"none";
        }
        else if (document.all)
        {
                // this is the way old msie versions work
                var style2 = document.all[whichLayer].style;
                style2.display = style2.display? "":"none";
        }
        else if (document.layers)
        {
                // this is the way nn4 works
                var style2 = document.layers[whichLayer].style;
                style2.display = style2.display? "":"none";
        }
}

CSS "Popup Window"

// Example of a css based "popup window"

        Click <a onmouseover='this.style.cursor="pointer" ' onfocus='this.blur();' onclick="document.getElementById('PopUp').style.display = 'block' " ><span style="text-decoration: underline;">herespan></a>
        <div id='PopUp' style='display: none; position: absolute; left: 50px; top: 50px; border: solid black 1px; padding: 10px; background-color: rgb(255,255,225); text-align: justify; font-size: 12px; width: 135px;'>
        This is a CSS Popup that can be positioned anywhere you want on the page and can contain any test and images you want.
        <br />
        <div style='text-align: right;'><a onmouseover='this.style.cursor="pointer" ' style='font-size: 12px;' onfocus='this.blur();' onclick="document.getElementById('PopUp').style.display = 'none' " ><span style="text-decoration: underline;">Closespan></a>div>
        </div>

Remove IE scrollbar place holder on non-scrolling pages

// If your page does not need to scroll, in certain situations IE may still show the browser gutter (placeholder for the scrollbar). Remove with this...

html {overflow:auto;}

CSS Alternative to iFrame

// description of your code here

<div style="padding:20px; overflow:auto; border:solid 1px black; width:400px; height:300px;"> 
Content goes here...
<div >
« Newer Snippets
Older Snippets »
4 total  XML / RSS feed