易截截图软件、单文件、免安装、纯绿色、仅160KB

使用javascript动态添加和删除table的行和列

第一种方法:使用insertRow添加行,使用insertCell添加单元格,再用innerHTML填充单元格。使用deleteRow删除行,代码如下:
Javascript代码:
function addRow()
  {
     var root = document.getElementById("tbody")
     var allRows = root.getElementsByTagName('tr');
     var allCells = allRows[0].getElementsByTagName('td');
     var newRow = root.insertRow();
     var newCell0 = newRow.insertCell();
     var newCell1 = newRow.insertCell();
     var newCell2 = newRow.insertCell();
     var newCell3 = newRow.insertCell();
     newCell0.innerHTML = allCells[0].innerHTML;
     newCell1.innerHTML = allCells[1].innerHTML;
     newCell2.innerHTML = allCells[2].innerHTML;
     newCell3.innerHTML = allCells[3].innerHTML;
  }
  function removeRow(r)
  {
    var root = r.parentNode;
    root.deleteRow(r);
  }
HTML代码:
<table>
  <tbody id="tbody">
    <tr>
        <td><select><option>hello</option><option>hi</option></select></td>
        <td><input type="text" value="enter you name here" /></td>
        <td><input type="text" value="text2"/></td>
        <td&g


相关文档:

锁屏JavaScript片段

var docEle = function() {
return document.getElementById(arguments[0]) || false;
}
function cloDiv(){
var overlayID="overlay";
var msgID = "overlayMsg";
document.body.removeChild(docEle(overlayID));
document.body.removeChild(docEle(msgID));
}
function openNewDiv() {
......

解决Firefox 下F5和IE下F5 不一致的javascript 脚本.

解决Firefox 下F5和IE下F5 不一致的javascript 脚本.
var check=function(e)
 {
  e=e||window.event;
  //alert(e.which||e.keyCode);
  if((e.which||e.keyCode)==116)
  {
   if(e.preventDefault)
   { e.preventDefault();}
&nb ......

javascript截取路径中的文件名

<!doctype html public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type"&nb ......

ActiveX组件与JavaScript交互

2007-10-24 23:55
1.在COM组件中调用JavaScript函数
// 连接点方式页面javascript脚本
<object classid="CLSID:B568F111-DFE4-4944-B67F-0728AB2AB30F" id="testCom" VIEWASTEXT></object>
<script language="JavaScript" for="testCom" event="staTe(s)">
      &n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号