javascript添加 runat

来源:百度知道 编辑:UC知道 时间:2024/05/31 15:59:42
我用javascript产生DIV元素,我怎么样用js来让这个DIV元素的runat属性为server?

ASP.Net吧?
runat = server是需要在服务器运行的,而js只有在客户端有效,因此,是不太可能的。

设置DIV 的 id=“test”
document.all.test.style.runat=server

假设楼主创建的DIV对象为 div

var div=document.createElement('div');

div.runat=server; 就行了...

祝楼主早日成功!