[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 276
  • Last Modified:

DHTML and OnMouseOver Event

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>
0
bgarland
Asked:
bgarland
1 Solution
 
TTomCommented:
Don't know if it's an acceptable answer, but you might consider using the 'title' property of your links.  At least in IE, it produces a popup when you mouseover the link.

Other than that, I think you are talking about a DHTML solution, which would require <DIV>s or <LAYER>s and onmouseover/onmouseout combinations.

The 'title' solution will also not 'intrude' on the layout of your HTML, which the other solution will.

Tom
0
 
PBallCommented:
have you try going the old way to it?

document.formname.textareaname.value = ......

instead?

remember, name property and id property might be different.
0
 
brigmarCommented:
I know this probably sounds silly....

but, you are setting the innertext property, when you should be setting the innerText property (uppercase T).

Javascript is case-sensitive.

That was easy :))

Brian
0
 
bgarlandAuthor Commented:
You're right...that was too easy.

Thanks to PBall too. Using the Value property worked just as well.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now