首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

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

2012-10-11 
js如何在HTML里面做成 鼠标移上去换文字有好多链接标签如:a idre alt新闻News/aa idre alt

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>

热点排行