Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Javascript] A loop this this script?
- From: mwarden at gmail.com (Matt Warden)
- Subject: [Javascript] A loop this this script?
- Date: Wed Jun 22 12:13:30 2005
something like:
var ids = Array('tutorials', 'scripting', 'validation');
navBar = document.getElementById("nav").rows[0].cells;
for (var i=0; i<navBar.length; i++)
{
navBar[i].onmouseover=function() {
document.getElementById(ids[i]).style.visibility="visible";
};
navBar[i].onmouseout=function() {
document.getElementById(ids[i]).style.visibility="hidden";
};
} // end for
Be careful about the order of the ids array, though.
On 6/21/05, Roland <rdong@xxxxxxxxxxx> wrote:
>
> I figured that the following script can be written using a for loop. But I
> tried without success. Can anyone throw some light on this? Thank you!
>
>
> ============================================================================
> <script type="text/javascript"><!--//--><![CDATA[//><!--
> startList = function() {
>
> navBar = document.getElementById("nav").rows[0].cells;
> navBar[0].onmouseover=function() {
>
> document.getElementById("tutorials").style.visibility="visible"
> }
>
> navBar[0].onmouseout=function() {
>
> document.getElementById("tutorials").style.visibility="hidden"
> }
>
> navBar[1].onmouseover=function() {
>
> document.getElementById("scripting").style.visibility="visible"
> }
>
> navBar[1].onmouseout=function() {
>
> document.getElementById("scripting").style.visibility="hidden"
> }
>
> navBar[2].onmouseover=function() {
>
> document.getElementById("validation").style.visibility="visible"
> }
> navBar[2].onmouseout=function() {
>
> document.getElementById("validation").style.visibility="hidden"
> }
> }
> window.onload=startList;
>
> //--><!]]></script>
> ===============================================
>
>
> _______________________________________________
> Javascript mailing list
> Javascript@xxxxxxxxxx
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
--
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com
This email proudly and graciously contributes to entropy.
- Follow-Ups:
- [Javascript] A loop this this script?
- From: Roland Dong
- [Javascript] A loop this this script?
- From: Andrew Clover
- [Javascript] A loop this this script?
- References:
- [Javascript] Need help determining when remote window closes.
- From: Glenn E. Lanier, II
- [Javascript] A loop this this script?
- From: Roland
- [Javascript] Need help determining when remote window closes.
- Prev by Date: [Javascript] Determining when a person leaves your domain
- Next by Date: [Javascript] Determining when a person leaves your domain
- Previous by thread: [Javascript] A loop this this script?
- Next by thread: [Javascript] A loop this this script?
- Index(es):