当前位置: 代码迷 >> Java Web开发 >> js怎么在HTML里面做成 鼠标移下去换文字
  详细解决方案

js怎么在HTML里面做成 鼠标移下去换文字

热度:5063   发布时间:2013-02-25 21:10:36.0
js如何在HTML里面做成 鼠标移上去换文字
有好多链接标签如:
<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>
  相关解决方案