javascript 对表格的操作和window.open居中

javascript对表格的操作:
function addTr()
{
var table = document.getElementById("apntable");
var lastTr = table.firstChild.lastChild;
if(lastTr.id == "lastLineStyleTr") {
lastTr.parentNode.removeChild(lastTr);
}
var input1 = document.createElement("input");
var row1 = table.insertRow(-1);
var row1_cell1 = row1.insertCell(-1);

row1_cell1.className = "tdlineleft";

row1_cell1.innerHTML = "<input id='apnname' name='apnname' size='6'></input>";
table.firstChild.appendChild(lastTr);//table有个隐藏的属性<tbody>所以要在table加入一行应该table.firstChild.appendChild(row)
i++;
}

window.open居中:

function changepassword(url,height,width)
{
screenX = window.screen.width;
screenY = window.screen.height;
var x = (screenX-width)/2;
var y = (screenY-height)/2;
window.open(url,null,"menubar:no,status:no,height:"+height+",width:"+width+",top="+y+",left="+x);
}

对于页面登录界面居中:

function showPosition() {
var windowHeight = document.body.offsetHeight;
var windowWidth = document.body.offsetWidth;
var loginDialog = document.getElementById("loginDialog");
var login = document.getElementById("login");
var loginHeight = login.offsetHeight;
var loginWidth = login.offsetWidth;
loginDialog.style.paddingLeft = (windowWidth - loginWidth)/2;
loginDialog.style.paddingTop = (windowHeight - loginHeight) / 3;

window.onresize = showPosition;
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值