vbscript/JScript 如何添加一个html元素并对其操作?

来源:百度知道 编辑:UC知道 时间:2024/06/04 11:17:23
譬如说我要用Vbscript或者JScript创建一个html对象<table>,其id为myTable,然后可以在其他地方用myTable.add()什么之类的方法把一些其他诸如<th>、<tr>、<td>的元素加进去?我知道像xml有类似的方法,但是不知道在怎么对html进行操作?
在网上搜了好久都搜不到类似的,最好就是能给Vbscript的,因为现在的project用得都是那个,统一一点比较好。实在不好用的话就JScript吧。

有,但是一下有跟你说不清楚,你可以到网上搜索下相关资料,给你段代码参考下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script>
i=0;
function tianjiajingyan(){
i++;
newrow=document.getElementById("jingyanxian").insertRow(0);
newrow.id="jingyanrow"+i;
newcell=newrow.insertCell(0);
newcell.innerHTML=" ";
newcell.width="5%";
newcell=newrow.insertCell(1);
newcell.innerHTML="<font color='red'><b>工作经验"+i+":</b></font>";
newcell.width="12%";
newcell2=newrow.insertCell(2);
newcell2.innerHTML="<textarea name='jingyan"+i+"' class='textarea' id=='jingyan"+i+"' cols='50' rows='3' style='overflow:visible;border-width:0px&