oElement = object.insertBefore(oNewNode [, oChildNode])ExampleThe following example shows how to use the insertBefore method to insert a new item into an existing list.HideExample<SCRIPT>
function insertElement()
{
var nod=document.createElement("LI");
oUL1.insertBefore(nod, oLIYellow);
nod.innerText="Orange";
}
</SCRIPT>
</HEAD>
<BODY>
<SPAN onclick=insertElement()>Click <B>HERE</B> to add an item to the following list.</SPAN>
<UL id="oUL1">
<LI id="oLIRed">Red</LI>
<LI id="oLIYellow">Yellow</LI>
<LI id="oLIBlue">Blue</LI>
</UL>
</BODY>
function insertElement()
{
var nod=document.createElement("LI");
oUL1.insertBefore(nod, oLIYellow);
nod.innerText="Orange";
}
</SCRIPT>
</HEAD>
<BODY>
<SPAN onclick=insertElement()>Click <B>HERE</B> to add an item to the following list.</SPAN>
<UL id="oUL1">
<LI id="oLIRed">Red</LI>
<LI id="oLIYellow">Yellow</LI>
<LI id="oLIBlue">Blue</LI>
</UL>
</BODY>
ParametersiIndex Optional. Integer that specifies where to insert the row in the rows collection. The default value is -1, which appends the new row to the end of the rows collection. Return ValueReturns the tr element object if successful, or null otherwise.
改为:var c = document.getElementsByName('tt');
var j = c.length;
for(var i=0; i<c.length; i++){
if(c[i].checked)
j=i;
}
var tr =t1.insertRow(j);
{
// Add new row
}
else
{
alert("Stop, ha");
}
触发onFocus 事件事,没反应了,无法触发事件! 因为,添加了多行,表单input的的名字都是一样,可能是这个原因吧! 请教一下应该怎么样去解决这个问题
楼主先结贴吧,问题越问越多,早都超出20分的范围了。
^_^