1. How to refresh the page using javascript
window.location.reload();
Use the pop-up window popped up by window.open() to refresh the parent window
window.opener.location.reload()
Use window.showDialog to pop up the modal window
window.dialogArguments.location.reload();
2. Two implementation methods of javascript pop-up windows---The following are two examples of pop-up screen-centered windows
window.open() method
Add the following statement to the jsp page
8.js controls the validity/invalidity of form elements
document.getElementById("bt").disabled=true;
document.all("Submit1").disabled=true; //Invalid
document.all("Submit1").disabled=false; //Valid
Set/get the value of the element
document.getElementById("labTitle").innerHTML="IP mode";//Set the value
document.getElementById("labTitle").innerHTML//Get the value
labTitle is the id of div, span, table
Example 1:
Example 2:
9. How the page submits the form through the function
var radios=document.getElementsByName("workMode");
var workMode="";
for(var i=0;i
workMode=radios[i].value; 🎜>
prov.options.add(new Option(sProvince,sZoneID));
}
12. How to use prototype ajax to submit data on the page (java)
Step one: Add the following js file link in
Three steps: Declare the following calling function in
//Set to get focus
document.getElementById("lindex").focus()
document.all.startip.focus()
//Set to lose focus
document.getElementById("lindex").blur()
document.all.startip.blur()
//Dynamicly generate table rows
var autoId = 0; // Auto-increment variable
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;
}
removefunctionRow(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. Create a new window
function layer1AddGroup() {
var url='/NDHotel/jsp/systemset/roomSet/addGroup.jsp';
var newwin=window .showModalDialog(url,window,"dialogWidth=470px;dialogHeight=400px;scroll=yes;status=no;help=no;");
}
//Refresh the parent page
function roomMainLeftRightFrame(){
var layer='<%=layer%>';
window.parent.parent.frames('view').location .href="/NDHotel/troom.do?method=roomSetLeftMenu&layer=" layer;
}
//IP address verification
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;
}