模态窗口

<!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" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
//模态窗口
function btnOpen_Click(w_sp1, h_sp1){
var url = "2.html";
var iTop2 = (window.screen.availHeight - 20 - h_sp1) / 2;
var iLeft2 = (window.screen.availWidth - 10 - w_sp1) / 2;
var params = 'menubar:no;dialogHeight=' + h_sp1 + 'px;dialogWidth=' + w_sp1 + 'px;dialogLeft=' + iLeft2 + 'px;dialogTop=' + iTop2 + 'px;resizable=yes;scrollbars=0;resizeable=0;center=yes;location:no;status:no'
var obj=window.showModalDialog(url, window, params);
document.getElementById("userId").value=obj[0];
document.getElementById("userAccount").value=obj[1];
document.getElementById("username").value=obj[2];
document.getElementById("userpwd").value=obj[3];
}
</script>
</head>

<body>

<b>1</b> <input id="userId" type="text" name="userId" />
<b>5</b> <input id="userAccount" type="text" name="userAccount" οnclick="btnOpen_Click(600,450);" />
<b></b> <input id="username" type="text" name="userId" />
<b></b> <input id="userpwd" type="text" name="userId" />
</body>
</html>

 

 

<!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" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function test(obj){
var td1 = obj.firstElementChild.firstChild.innerHTML;//1
var td2=obj.lastElementChild.firstChild.innerHTML;//5
var td3=obj.firstElementChild.nextElementSibling.firstElementChild.innerHTML;
var td4=obj.firstElementChild.nextElementSibling.nextElementSibling.firstElementChild.innerHTML;
var array=new Array();
array.push(td1);
array.push(td2);
array.push(td3);
array.push(td4);
window.returnValue=array;
window.close();
}
</script>
</head>

<body>
<table border="1" id="table">
<tr>
<td><input name="" id="" value="序号" /></td>
<td><input name="" id="" value="数量" /></td>
<td><input name="" id="" value="序号" /></td>
<td><input name="" id="" value="数量" /></td>
</tr>
<tr οndblclick="test(this)" id="1">
<td><div>1</div></td>
<td><div>2</div></td>
<td><div>4</div></td>
<td><div>5</div></td>
</tr>
<tr οndblclick="test(this)" id="2">
<td><div>11</div></td>
<td><div>12</div></td>
<td><div>13</div></td>
<td><div>14</div></td>
</tr>
<tr οndblclick="test(this)" id="3">
<td><div>15</div></td>
<td><div>16</div></td>
<td><div>17</div></td>
<td><div>18</div></td>
</tr>
</table>
</body>
</html>

转载于:https://www.cnblogs.com/lanliying/p/4088697.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值