我用编程的方法动态生成了table,现在想给每一个table增加一个onMouseOver="SetIndex(1)"的方法。
在html里面直接可以这样写<table onMouseOver="SetIndex(1)">
但是我是动态生成的表格,在程序里应该怎样给table添加这个事件呢?
在html里面直接可以这样写<table onMouseOver="SetIndex(1)">
但是我是动态生成的表格,在程序里应该怎样给table添加这个事件呢?
for(int i=0;i<4;i++)
{
Table tb=new Table();
……
}
在生成的页面的代码都是<table>……</table>
我现在想让他变成<table onMouseOver="SetIndex(1)">……</table>
那在生成table的语句应该怎么样改。
谢谢!
tb.Attributes.Add("onMouseOver", "SetIndex(1)")
tb.Attributes.Add("onMouseOver", "SetIndex(1)"); //pay attention to here