Ask Experts Questions for FREE Help !
Ask
    nitika123's Avatar
    nitika123 Posts: 8, Reputation: 1
    New Member
     
    #1

    Sep 14, 2009, 11:37 PM
    Mouse Over in Javascript expand collapse menu
    Hi All,

    I am new to javascript. I am using the below javascript for expand collpase menu. When user clicks to expand the menu, -image appears and when clicks to collapse the menu,+ image appears. I want to use the sme script for mouse hover. How can I.



    <script type="text/javascript">
    document.getElementById('personal_details').style. display='none';
    document.getElementById('income_details').style.di splay='none';
    document.getElementById('return_details').style.di splay='none';
    document.getElementById('filing_details').style.di splay='none';

    function switchMenu(id)
    {
    obj=document.getElementById(id);
    col=document.getElementById("x" + id);

    if (obj.style.display=='none')
    {
    obj.style.display='block';
    col.innerHTML="<img src='/it_media/v4/n/images/minus2.gif'/>";
    }
    else
    {
    obj.style.display='none';
    col.innerHTML="<img src='/it_media/v4/n/images/plus2.gif'/>";
    }
    }

    </script>
    sharepointer's Avatar
    sharepointer Posts: 1, Reputation: 1
    New Member
     
    #2

    Dec 9, 2010, 04:17 AM

    paste the below script in your page header

    <SCRIPT type=text/JavaScript langauge="JavaScript">
    function doMenu(item) {
    obj=document.getElementById(item);
    col=document.getElementById("x" +item);
    if (obj.style.display=="none") {
    obj.style.display="block";
    col.innerHTML="<img src='//images/Minus.gif'/>";
    }
    else {
    obj.style.display="none";
    col.innerHTML="<img src='//images/Plus.gif'/>";
    }
    }
    </SCRIPT>

    apply below code in form

    <a id="xmain14" href="javascript:doMenu('main14');" > <img src='//images/Plus.gif'/></a>

    create content using DIV's like below.

    <DIV style="DISPLAY: none" id=main14> your content </DIV>

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Collapse and Expand HTML code [ 3 Answers ]

Hi All, I'm hoping you can help. I'm working on my wordpress site and creating a FAQ's page and would like to get a code so that a user clicks on a question and the answer collapse and expands on the same page. I've searched other posts to find this but only came across a code for collapse...

Right click mouse menu disappeared [ 3 Answers ]

This morning I messed up my Vista Lenovo laptop. Probably I pressed some keys in the wrong sequence and I had this behaviour: When I pressed "U" a "4" was typed on the screen and the right click menu of the mouse disappeared. The first thing was easy to repair, it was simply the NumLock "on"....


View more questions Search