Common js Supplements 1 and js supplements
Google js debugging
Press f12 to enter js debugging mode
Hitting the corresponding js file and hitting the breakpoint in the js Program
Press F10 for debugging.
Press F8 to finish
Used to display operation information
<Script>
Window. onload = function ret (){
Var msg = '$ {requestScope. msg }';
If (msg! = "" & Msg! = Null ){
Alert (msg );
}
}
</Script>
Change the value of the text box
<Input name = "btProductModel. productType" checked = "checked" type = "radio" onclick = "changeShow (this. value)" value = "01"> pre-Casting Production
<Input name = "btProductModel. productType" type = "radio" checked = "checked" onclick = "changeShow (this. value)" value = "03"> rework Production
Function changeShow (value ){
If (value = "01 "){
Document. getElementById ("productcode"). innerHTML = "Product NO ";
Document. getElementById ("productname"). innerHTML = "precasting product ";
} Else {
Document. getElementById ("productcode"). innerHTML = "repair number ";
Document. getElementById ("productname"). innerHTML = "original contract No ";
}
}
Close Window
Function closeWindows (){
Window. open ('', '_ parent ','');
Window. opener = window;
Window. close ();
}
Js automatically adds a table instead of adding a row of the table.
Var tbl = document. createElement ("table ");
Tbl. id = table2; // name it as needed
Tbl. style = "tableCSS ";//
Tbl. innerHTML = "<tbody> <tr> <td>... </tbody>"; // here is your table content
Document. appendChild (tbl );
Js I want to add a colon In The Middle Of 1100, such as. How can I implement it using code?
If many of them need to be processed in this way, add the for loop <script type = "text/javascript"> <-- var str = "1100 ";
Str11 = str. substring (0, 2 );
StrSep = ":";
Str00 = str. substring (2, str. length );
StrNew = str11 + strSep + str00;
Alert (strNew );
-->
</Script>