Common js Supplements 1 and js supplements

Source: Internet
Author: User

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>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.