|
I apologize if this question has been addressed already, but I don't have time right now to search through the previous inqueries to find what I need. What I want to do is a mouseover text change that is not a link. For instance, if I have the text 'Guten Tag', I want the text to change on a mouseover to 'Good Day', as a rollover translation type thing. I found a code that's supposed to do this, but it doesn't work:
<script type="text/javascript">
var oldText="";
function replaceText(elem, newText) {
oldText=elem.firstChild.data;
elem.firstChild.data=newText;
}
function restoreText(elem) {
elem.firstChild.data=oldText;
}
</script>
<span onmouseover="replaceText(this, 'Good Day');" onmouseout="restoreText(this)">Guten Tag</span>
Any advice/help?
|
|
|
Hi,
To change the text on mouseover event you can use the following code, as
Script
<script type=text/javascript>
function changeme()
{
document.getElementById("b1").innerText= "Good Day";
}
function restoreme()
{
document.getElementById("b1").innerText= "Guten Tag";
}
</script>
Html Code
<span id="b1" onmouseover="changeme()" onmouseout="restoreme()">Guten Tag</span>
Regards,
Valli
|
|
|
|
|
|
|
|