Well you will have to enclose it in some kind of tag - which will become an object or node which you can reference using JavaScript. Here is how to do it for IE5 NS6:
...
</script>
function setText(object){
object.innerText = "This is now different"
}
</script>
...
...
<span onMouseOver="setText(this)" origText="text here!" onMouseOut="this.innerText=this.origText">text here!</span>...
You could extend this to work with many of these elements using one function, if you add that the function accepts a string as an argument, and then uses that string as the new innerText. This will also work with IE4.x.
Also I have created a variable belonging to the span object simply by defining it in the tag - this is far sinpler than using prototype - and gives a simple mouse out reset which can be cut and pasted into any tag - assuming variable naming is consistent.
Also you can use any tag which has innerText, <b>, <i> whatever. All you need is a node.
If you wanted to change the formatting of the text - then use InnerHTML instead of innerText - this way the new text could be a different color, size, weight etc...
hope this helps - ;-)
b[sup]2[/sup] - benbiddington@surf4nix.com
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.