Tyme,
Very close :0) You're just missing the declarator for the function
("function"):
function showLeisureSub() {
document.getElementById("LeisureSub").style.display = "block";
}
For extra behavioral separation, you might even try this:
<script type="text/javascript">
function initLeisureSub() {
var pl = document.getElementById('pLeisure');
// hide LSub on page load
toggleLSub();
// attach mouseover and mouseout event x-browser
if(pl.addEventListener){
pl.addEventListener("mouseover",toggleLSub,function(){ls.style.display
= 'block';}
} else if(pl.attachEvent){
pl.attachEvent("onmouseover",toggleLSub)function(){ls.style.display
= 'block';}
}
window.onload = initLeisureSub;
</script>
This abstracts the behavior from the HTML entirely by putting
attaching onmouseover events directly to the HTML objects, attaches an
onload to the window object and does some basic x-browser event
handling. The above would also change your HTML to something like
this:
<p id="pLeisure" class="navbutton">
<a href="Leisure.asp" class="navbutton"
onclick="javascript:alert('coming soon!')">LEISURE</a>
</p>
<div id="LeisureSub" class="nomargin">
<ul>
<li><a href="Leisure_Spotlight.asp" class="navbutton"
onclick="javascript:alert('coming soon!')">spotlight</a></li>
<li><a href="Leisure_Movies.asp" class="navbutton"
onclick="javascript:alert('coming soon!')">movies</a></li>
<li><a href="Leisure_LocalEvents.asp" class="navbutton"
onclick="javascript:alert('coming soon!')">local events</a></li>
</ul>
</div>
We won't talk about the onclick JS alerts :|
Now... If you're super anal or just retarded (like myself), you might
go so far as to do something like this:
function toggleLSub(){
var ls = document.getElementById('LeisureSub');
if(ls.style.display == 'block' || ls.style.display == ''){
ls.style.display = 'none';
} else {
ls.style.display = 'block';
}
}
function initLeisureSub() {
var pl = document.getElementById('pLeisure');
// hide LSub on page load
toggleLSub();
// attach mouseover and mouseout event x-browser
if(pl.addEventListener){
pl.addEventListener("mouseover",toggleLSub,false);
pl.addEventListener("mouseout",toggleLSub,false);
} else if(pl.attachEvent){
pl.attachEvent("onmouseover",toggleLSub);
pl.attachEvent("onmouseout",toggleLSub);
}
}
The benefits of the second block, plus it abstracts out the on / off
state of the block (presuming you want to show / hide it). Right, off
to eat some more OCD cookies.
cheers!
Stephen
On 7/26/05, Tyme <[EMAIL PROTECTED]> wrote:
> Okay, I know that this is incredibly simple. It is just a matter of my
> staring at it so long that I am overlooking the very obvious. [As soon as I
> ask for help, I figure it out myself. :-) ]
____ The WDVL Discussion List from WDVL.COM ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] or
use the web interface http://e-newsletters.internet.com/discussionlists.html/
Send Your Posts To: [email protected]
To change subscription settings, add a password or view the web interface:
http://intm-dl.sparklist.com/read/?forum=wdvltalk
________________ http://www.wdvl.com _______________________
You are currently subscribed to wdvltalk as: unknown lmsubst tag argument: ''
To unsubscribe send a blank email to [EMAIL PROTECTED]
To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016
Please include the email address which you have been contacted with.