标签:var cell javascrip 表格 get sof cti ref sch
<body>
<table id="tab">
<tr><td>0</td></tr>
<tr id="x"><td>1 在此行下插入新行</td></tr>
<tr><td>2</td></tr>
</table><br>
<input type="button" onclick="javascript:instTR()" value="插入行">
<script type="text/javascript">
function instTR(){
var tab=document.getElementById(‘tab‘);
var n=document.getElementById(‘x‘).rowIndex+1;
var tr=tab.insertRow(n);
var td=tr.insertCell(0);
td.innerHTML=‘new ‘+Math.random();
}
</script>
</body>
<html>
<head>
<script>
function changeLink()
{
document.getElementById(‘myAnchor‘).innerHTML="W3Cschool";
document.getElementById(‘myAnchor‘).href="http://www.w3cschool.cc";
document.getElementById(‘myAnchor‘).target="_blank";
}
</script>
</head>
<body>
<a id="myAnchor" href="http://www.microsoft.com">Microsoft</a>
<input type="button" onclick="changeLink()" value="Change link">
</body>
</html>
标签:var cell javascrip 表格 get sof cti ref sch
原文地址:http://www.cnblogs.com/ailsalin/p/6568156.html