Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Onmouse Out Function for tr to empty contents
Old 03-15-2007, 05:15 PM Onmouse Out Function for tr to empty contents
Junior Talker

Posts: 1
Name: Bill
Trades: 0
So far I've made the table update the submnu by clicking on the topmnu item. What I want to happen is when the mouse leaves the table area i want it to clear the contents of the submnu. I call the loadmnu function from the body onload. Everything else is working fine!

The javascript is as follows :
Code:
            var mnu = new Array();
            mnu[0] = new Array("Home",new Array());
            mnu[0][1] = new Array("Homepage","http://www.slackpaq.com");
            mnu[0][2] = new Array("About","http://www.slackpaq.com/about");
            mnu[0][3] = new Array("Contact","http://www.slackpaq.com/contact");
            mnu[1] = new Array("Videos",new Array());
            mnu[1][1] = new Array("Search","http://www.slackpaq.com/videos/search");
            mnu[1][2] = new Array("Upload","http://www.slackpaq.com/videos/upload");
            mnu[2] = new Array("Audio",new Array());
            mnu[2][1] = new Array("Search","http://www.slackpaq.com/audio/search");
            mnu[2][2] = new Array("Upload","http://www.slackpaq.com/audio/upload");
            
            function loadmnu ()
            {
                for (var i = 0; i < mnu.length; i++)
                {
                    document.getElementById('topmnu').innerHTML += "<td width=80px onclick='loadsubmnu(" + i + ")'>" + mnu[i][0] + "</td>";
                }
            }
            function loadsubmnu (id)
            {
                document.getElementById('submnu').innerHTML = "";
                for (var i = 1; i < mnu[id].length; i++)
                {
                    document.getElementById('submnu').innerHTML += "<td width=80><a href=" + mnu[id][i][1] + ">" + mnu[id][i][0] + "</a></td>";
                }
            }
            function empty(itm)
            {
                
                itm.innerHTML = "<td colspan=100%>&nbsp;</td>";
            }
The HTML table is as follows :
HTML Code:
        <table height=20 border=1 cellspacing=0 cellpadding=0>
            <tr id="topmnu">
            </tr>
            <tr height=20 id="submnu" onmouseout="empty()">
            <td width=100% colspan=100%>&nbsp;</td>
            </tr>
        </table>
Any Ideas?!?!?
wfinken is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to Onmouse Out Function for tr to empty contents
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.60405 seconds with 12 queries