日期:2014-05-16  浏览次数:20536 次

帮忙看看 onMouseOver 怎么加?
<html>
<head>
<title> 校内新闻 </title>
</head>
<body>

<table   border=0   width=190>
<tr> <td   colspan=2   height=10> </tr>
<tr>
    <td   width=8   align=center> </td>
    <td   width=182   align=left> 校内新闻1 </td>
</tr>
<tr>
    <td   width=8   align=center> > </td>
    <td   width=182   align=left> 校内新闻2 </td>
</tr>
<tr>
    <td   width=8   align=center> </td>
    <td   width=182   align=left> 校内新闻3 </td>
</tr>
<tr> <td   colspan=2   height=10> </tr>
</table>

</body>
</html>
========================
当前结果是:

      校内新闻1
  >   校内新闻2
      校内新闻3

==========   我想动态的实现鼠标移到新闻1上时> 出现2和3上的> 消失,移到2上时> 出现1和3上> 消失,移到3上时> 出现1和2消失============

我该怎么写?

------解决方案--------------------
<html>
<head>
<title> 校内新闻 </title>
</head>
<body onLoad= "init(); ">
<script>
function init(){
var table = document.getElementById( "table1 ");
var spans = table.getElementsByTagName( "span ");
for(var i = 0 ; i < spans.length ;i++){
spans[i].onmouseover = function(){
this.innerHTML = "> " + this.innerHTML;
}
spans[i].onmouseout = function(){
if(this.innerHTML.indexOf( "> ") != -1) this.innerHTML = this.innerHTML.substring(1);
}
}
}
</script>
<table border=0 width=190 id= "table1 ">
<tr> <td colspan=2 height=10> </tr>
<tr>
<td width=8 align=right> </td>
<td width=182 align=right> <span id= "test "> 校内新闻1 </span> </td>
</tr>
<tr>
<td width=8 align=right> </td>
<td width=182 align=right> <span id= "test "> 校内新闻2 </span> </td>
</tr>
<tr>
<td width=8 align=right> </td>
<td width=182 align=right> <span id= "test "> 校内新闻3 </span> </td>
</tr>
<tr> <td colspan=2 height=10> </tr>
</table>

</body>
</html>
------解决方案--------------------
onmouseover,onmouseout都要写
类似以下:
<script>
function show1(i,v)
{

document.getElementById(i).innerHTML = '> '+v;
}
function show2(i,v)
{
var x = v;
document.getElementById(i).innerHTML = x.replace(/^&gt;(.*)/, '$1 ');
}
</script>
<table border=0 width=190>
<tr> <td colspan=2 height=10> </tr>
<tr>
<td width=182 align=left id= "new1 " onmouseover= "show1(this.id,this.innerHTML) " onmouseout= "show2(this.id,this.innerHTML) "> 校内新闻1 </td>
</tr>
<tr>

<td width=182 align=left id= "new2 " onmouseover= "show1(this.id,this.in