有好多链接标签如:
<a id="re" alt="新闻">News</a>
<a id="re" alt="产品">Products</a>
<a id="re" alt="其它">Other</a>
我想让鼠标移到比如News链接上时, News这几个字就换为中文“新闻”。
请问这个JS该怎么写呀?
------解决方案--------------------------------------------------------
- HTML code
<html><head><script>function changeShow(obj){ obj.innerText="123123123123";}</script></head><body><a id="re" alt="asdf" onmouseover="changeShow(this);">News</a></body></html>
------解决方案--------------------------------------------------------
function check(obj){
obj.title=obj.innerText;
obj.innerText=obj.alt;
obj.alt=obj.title;
}
<a id="re" onmouseover="check(this)" onmouseout="check(this)" alt="新闻">News</a>
<a id="re" onmouseover="check(this)" onmouseout="check(this)" alt="产品">Products</a>
<a id="re" onmouseover="check(this)" onmouseout="check(this)" alt="其它">Other</a>