...

View Full Version : <Span> tag



alex57
01-06-2007, 05:09 PM
I have a three <span></span> sections and when each is clicked another section is loaded and another is hid using code similar to below:


document.all.menu0.style.display = 'none';
document.all.menu2.style.display = 'none';
document.all.menu3.style.display = 'block';

I have an onload function which hides two of the sections intially BUT all the sections are visible initially for a split second and then disappear as the onload event kicks in. this flash of all the segments is messy. Any ideas on how to prevent this??

Thanks

Mr J
01-06-2007, 05:49 PM
document.all is IE only and you should be using document.getElementById()

document.getElementById("menu0").style.display = 'none';
document.getElementById("menu2").style.display = 'none';
document.getElementById("menu3").style.display = 'block';


Create style rules to initially set the spans display value to none

You can create individual rules for each span

#menu0{
display:none;
}

#menu1{
display:none;
}

#menu2{
display:none;
}

or one for all and add class="hide" to each span

.hide{
display:none;
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum