1.Javascript刷新页面的方法
window.location.reload();
使用window.open()弹出的弹出窗口,刷新父窗口
window.opener.location.reload()
使用window.showDialog弹出的模式窗口
window.dialogArguments.location.reload();
2.Javascript弹出窗口的两种实现方式 ---下面给两个弹出屏幕居中窗口的例子
window.open()方式
3.页面中设置不进行缓存数据的方法
在jsp页面加入如下语句
window.clearTimeout(me.timer);
window.clearInterval(me.timer);
/script
三步:在中声明以下调用函数
//设置获取焦点
document.getElementById("lindex").focus()
document.all.startip.focus()
//设置失去焦点
document.getElementById("lindex").blur()
document.all.startip.blur()
//动态生成table的行
var autoId = 0; // 自增变量
function addRow(value1,value2){
var highQuery=document.getElementById("tdSearch");
highQuery.insertRow();
var newRow = highQuery.rows[highQuery.rows.length - 1];
newRow.id = "row_" + autoId;
newRow.insertCell();
newRow.cells[0].innerHTML = "-";
newRow.insertCell();
newRow.cells[1].innerHTML = " ";
var cell2 = newRow.insertCell();
cell2.innerHTML = "";
cell2.setAttribute("class", "yellowCell2");
autoId=autoId+1;
}
function removeRow(rowId){
var trRow = document.getElementById(rowId);
//alert(trRow);
//if(rowId!="row_0"){
trRow.removeNode(true);
//}
}
form1.action="/NDHotel/jsp/systemset/roomSet/uploadFile.jsp";
form1.submit();
16.新建一个窗口
function layer1AddGroup() {
var url='/NDHotel/jsp/systemset/roomSet/addGroup.jsp';
var newwin=window.showModalDialog(url,window,"dialog);
}
//刷新父页面
function roomMainLeftRightFrame(){
var layer='<%=layer%>';
window.parent.parent.frames('view').location.href="/NDHotel/troom.do?method=roomSetLeftMenu&layer="+layer;
}
//IP地址验证
function ipCheck(ipValue){
var reg = /^/d{1,3}(/./d{1,3}){3}$/;
if(ipValue != ""){
if (reg.test(ipValue)){
var ary = ipValue.split('.');
for(key in ary){
if (parseInt(ary[key]) > 255 )
return false;
}
return true;
}else
return false;
}else
return true;
}