Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

onmouseout + textarea

Status
Not open for further replies.

vlitim76

Programmer
Jun 1, 2006
19
GB
I have some code that is meant to trigger an even when the mouse rolls out of the textarea. This works fine if the amount of data in the textarea does not require a scrollbar, but as soon as the scrollbar appears the onmouseout is triggered when I roll onto the textarea as well.

Has anyone got any idea why this would occur??

Code:
<div>
<textarea style="width:100px; height:80px" onmouseout="doSomething()">some data in here that has more height than the control</textarea>
</div>


Thanks

Tim
 
Has anyone got any idea why this would occur??

Yes - because the scrollbar element is being treated as a different element... so when you roll out of the textarea onto the scrollbar the event fires, as well as when you roll out of the textarea itself.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
ok that makes sense, but how can I deal with this so it only fires when the mouse is out of the whole element?

cheers
 
I need to know when the mouse has actually left the textarea so I can then save the data and inform the user, at the moment the user is informed wheh you rollover as well which is no good. I need to make sure that I onlt save the data on mouseout.

cheers
 
I think that's really bad functionality. What if the user accidentally gets the shakes, or the mouse gets knocked by their cat? Why not just have a "Save" or "Update" button? It would certainly solve your issue.

As I said - you need to make your code more robust if it's obvious (which it should be by now) that you can't fix this issue in all browsers.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top