cell.onmouseout=function(){ this.className="today"; }
这个可以运行。但下面那个把函数写在其他地方
cell.onmouseover=test();
function test(){this.className="today"; }
这样就不行了?
这个可以运行。但下面那个把函数写在其他地方
cell.onmouseover=test();
function test(){this.className="today"; }
这样就不行了?
解决方案 »
- window.print问题,请帮忙!---------100分求助--在线等!
- 请帮忙看看这段JS代码用什么加密的
- 一个多表单的切换问题
- checkbox 全选问题
- 怎么实时的触发文本框事件?就是输入后就触发,而不是失去焦点的时候触发事件。
- button的value的值如何分行显示?
- 除了showModalDialogue之外还有什么办法达到与其相同效果的办法吗?
- 请问如何用javascript和xml实现查询sql server数据库的功能?
- [急]关于找到并确认<table>所对应的</table>?
- 这段代码有什么错,我实在看不出
- javascript中怎样调用windows api?
- 急:怎么在js中连接本地的打印机打印一段文本
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>New Page 2</title>
</head><body>
<table border="1" width="251" height="181" id=tableid >
<tr>
<td width="121" height="47">1</td>
<td width="114" height="47">2</td>
</tr>
<tr>
<td width="121" height="122">3</td>
<td width="114" height="122">mouseout</td>
</tr>
</table>
</body></html>
<script>
var tablecon = tableid;
var cell = tablecon.rows[1].cells[1];cell.onmouseover=function(){ this.innerText="mouseover"; }cell.onmouseout=function(){ this.innerText="mouseout"; }
//cell.onmouseover=test();
//function test(){this.className="today"; }//这样写的话,this指代的是本函数,而不是cell,所以不行</script>
//function test(){cell.className="today"; }//这样写的话,this指代的是本函数,而不是
还是不行。cell.attachEvent("onmouseout",funName)
这个可以,但不管鼠标移出什么地方总是最下面的一个表格被改了颜色。
cell.attachEvent("onmouseout",funName)
cell.attachEvent("onmouseover",funName2)
cell.attachEvent("onmouseover",funName2)
这个还是光改变最后一个表格的颜色,是不是每次总是传一样的值造成的。怎样给funName函数传递值呢?
cell.attachEvent("onmouseout",funName(1))这样就不行,该如何呢?