1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | <p>An advertisement that you don't want printed out. <p>Another advertisement that you don't want printed out. <div id=printable> <table width=40% cellpadding=3 cellspacing=0 border=1> <tr><th>Name</th><th>Age</th><th>Height</th></tr> <tr><td>John Q</td><td>23</td><td>6'1"</td></tr> <tr><td>Jane Q</td><td>23</td><td>5'1"</td></tr> <tr><td>Jimmy R</td><td>23</td><td>5'6"</td></tr> </table> </div> <p><input type=button id=printButton value="Print"> <p>All the annoying disclaimer text you don't want printed out. // Capture the click on the "Print" button. Then, you can call the printArea() // function on the "printable" div we used to wrap the portion of the page we want // printed. The only thing that will get printed to the printer will // be the table, and all the annoying text won't be. $("#printButton").click(function(){ $("#printable").printArea(); }); |
1 2 3 4 5 6 7 | <p>Alpha-only: <input type=text width=20 id=alphaOnly> <p>Numeric-only: <input type=text width=20 id=numericOnly> // This code will prevent unworthy characters from being entered // into our text fields, assuring valid input $("#alphaOnly").alpha(); $("#numericOnly").numeric(); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | // will only allow numerals and the . // and , characters (because I'm thinking international // here, and some countries use a , for a decimal) $("#decimalOnly").decimal(); // same as the above, but it adds support for the "%" $("#percentOnly").percent(); // as described above, only allows valid e-mail characters $("#emailOnly").email(); // allows only numbers and the ( and ) and - characters $("#phoneOnly").phone(); // allows only numbers and the : character $("#clockOnly").clock(); // allows only numbers and the / and - characters $("#dateOnly").date(); // this is the only one that's slightly different, in that // it requires you to pass in the valid currency symbol, so you can // pass in a pound sign or euro if you're using this overseas $("#currencyOnly").currency("$"); |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |