We help IT Professionals succeed at work.
Get Started

DHTML and OnMouseOver Event

bgarland
bgarland asked
on
292 Views
Last Modified: 2013-12-25
I have a textarea field on my page that I want to use to display a short description of a link when the user moves the mouse over the link. I want to create an array that contains the link descriptions then have the onmouseover event call a function that references the corresponding array element for the that link. Below is the code I've got so far. I don't get an error, but the text will not change when the mouse moves over the link.

<form method="POST" action="--WEBBOT-SELF--">
<p><textarea rows="2" id="LinkTextBox" name="LinkTextBox" cols="29" style="color: #000080">Default text goes here.</textarea></p>
      </form>
      <script language="JavaScript">
       changetext=new Array()
       changetext[0]="Welcome to my menu, mouseover the item text to see what they are."
            changetext[1]="This is info about item 1"
            changetext[2]="This is info about item 2"
            changetext[3]="Item3"
            changetext[4]="And last but not least, item 4"
            
            function changelinkboxtext(num){
            document.all.LinkTextBox.innertext=changetext[num]
            }
      </script>
      <ul>
        <li><a onmouseover="changelinkboxtext(1)" HREF="LINK.HTM">Menu Item 1</a> <br>
        </li>
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE