View Full Version : Change text on mouseover links


duckgirl
08-27-2003, 08:50 AM
Ok... so you know how you can have mouseover images, and the button might say "About" and when you run your mouse over it, you get the button that says "Our project explained" or something. I know how to do mouseover images, but I'm wondering if you can do that for text. The text-transform thingy that you can add to your a:hover section of the stylesheet, like text-transform:uppercase, which makes your text all capitalized made me wonder. Is there anyway to make your text change from "La la" to "Whee" on mouseover? Should I even be asking this in the css section?

Lydia
08-27-2003, 02:23 PM
<html>
<head>
<script type="text/javascript">
function def(val) {
div1.innerHTML = val;
}
function change(val) {
div1.innerHTML = val;
}
</script>
</head>
<body>
<p id="div1" onmouseover="change('New Text');" onmouseout="def('Old Text');">Old Text</p>
</body>
</html>

i edited your message a bit (the parts in red), because you had two times <body> tag in your coding etc. The code itself however is perfectly fine :) ~ mod

duckgirl
08-28-2003, 03:50 AM
Yeah, that works as text, but I want a link... I just tried the code out, so I'll see if I can figure it out myself, but does anyone else know?

But thanks, it's a neat script!