这里用的是 jquery 1.4.1 的库文件,具体代码如下:
代码如下 | 复制代码 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
varid = 0; functionaddInfo() { varcpu = document.getElementById("txtCpu"); varzhuban = document.getElementById("txtZhuban"); varneicun = document.getElementById("txtNeicun"); varyingpan = document.getElementById("txtYingpan"); vartb = document.getElementById("tbAdd"); //alert("数据插入成功!"); vartr = tb.insertRow(); vartd0 = tr.insertCell(); td0.innerHTML = id; vartd1 = tr.insertCell(); td1.innerHTML = cpu.value; vartd2 = tr.insertCell(); td2.innerHTML = zhuban.value; vartd3 = tr.insertCell(); td3.innerHTML = neicun.value; vartd4 = tr.insertCell(); td4.innerHTML = yingpan.value; id++; $("#tbAdd").append(tr); } $(function() { varclickedTrIndex = -1; $("#addForm>input[type=button]") .live("click",function() { $("#tbAdd tr:has(td):even").css("background","#ebebeb"); }); //绑定鼠标移入移出事件到表格的行 $("#tbAdd tr:has(td)") .live("mouseover",function() { $(this).css("cursor","pointer").css("background","#bcc7d8"); }) .live("mouseleave",function() { vartrIndex = $(this).index(); if(trIndex % 2 == 0) { $(this).css("background","#ebebeb"); } else{ $(this).css("background",""); } }) .live("mousedown",function(event) { if(event.button == 2) { x = event.clientX; y = event.clientY; $("#contextMenu").css("display","block").css("left", x).css("top", y); clickedTrIndex = $(this).index(); } }); $("#contextMenu") .mouseover(function() { $(this).css("cursor","pointer"); }); $("body") .live("mouseup",function(event) { if(event.button == 0) { $("#contextMenu").css("display","none"); } }); $("#contextMenu li") .mouseover(function() { $(this).css("background","#C1D7EE"); }) .mouseout(function() { $(this).css("background",""); }) .click(function() { vardeleteStr = $(this).children("a").attr("title"); if(deleteStr =="delete") { $("#tbAdd tr:has(td):eq("+ clickedTrIndex +")").remove(); } else{ alert("按下了:"+ deleteStr); } }); });
#tbAdd{ } #tbAdd tr td{ height:30px; text-align:center; } #tbAdd thead tr th{ width:90px; height:30px; text-align:center; } #addForm input[type=text]{ margin-bottom:8px; width:150px; } #contextMenu{ width:150px; padding:5px 0px 5px 5px; line-height:24px; background-color:#F0F0F0; position:absolute; display:none; } #contextMenu ul{ margin:0px; } #contextMenu li{ margin:0px; margin-left:-15px; float:left; width:100%; list-style-type:none; } #contextMenu li a{ text-decoration:none; padding:5px 0px 5px 12px; display:block; color:#282828; }
|
敢达决战官方正版 安卓版v6.7.9
下载敢达决战 安卓版v6.7.9
下载像素火影骨架佐助 (Perseverance Fire Shadow)手机版v1.16
下载要塞英雄 安卓版v33.20.0-39082670-Android
下载梦想城镇vivo最新版本 安卓版v12.0.1
梦想城镇vivo版是这款卡通风模拟经营类手游的渠道服版本,玩
怦然心动的瞬间 安卓版v1.0
怦然心动的瞬间是一款真人向的恋爱互动游戏,在游戏中玩家将扮演
曼尼汉堡店游戏 安卓版v1.0.3
曼尼汉堡店是一款非常好玩的精品恐怖类型冒险游戏,在这款游戏中
现代总统模拟器去广告版 安卓版v1.0.46
现代总统模拟器是一款休闲养成类游戏,可能对于不少的玩家来说都
现代总统模拟器付费完整版 安卓版v1.0.46
现代总统模拟器高级版在商店是需要付费的,相对于普通版本,高级