Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

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

You are here: irt.org | FAQ | DHTML | Q193 [ previous next ]

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?'

©2018 Martin Webb