Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q193 Is there a way to do an onMouseOver on text, i.e. not a link and not an image?

irt.org | Knowledge Base | DHTML | Q193 [ previous next ]

Q193 Is there a way to do an onMouseOver on text, i.e. not a link and not an image?

It is possible but only in Netscape Navigator 4 and Internet Explorer 4. You'll need to use a link - but you can make the link without the underline and without it going anywhere.

<html>
<head>
<style><!--
#style1 { color: orange; text-decoration: none }
//--></style>
</head>

<body>

<script language="JavaScript"><!--
function myvoid() {}
//--></script>

<p>This is some text outside,
<a href="javascript:myvoid()" onMouseOver="alert('hello world')">
<span id="style1">this is some text inside</span></a>,
and this is more text outside

</body>
</html>

I've used an alert, but this can be replace with code that does whatever you want.

The following was submitted by Peter A. List

Easy in Internet Explorer 4+ - just include the actions & events inside a div or span tag.

<form name="Out">
<input type="text" size="35" name="put" onFocus="blur()" value="You have not yet moved over the text">
</form>

<span
  onMouseOver="document.Out.put.value='Now you are over the text'"
  onMouseOut="document.Out.put.value='Hey, you moved away from the text!'">
Mouse over me, and the text in the input will change
</span>

Feedback on 'Q193 Is there a way to do an onMouseOver on text, i.e. not a link and not an image?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.