fmpq.com
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Fmpq教程(fmpq.com)</title> </head> <body> <p id="demo">单击按钮来调用新的myMet()方法,并显示55一半数量值,使用新的构造函数myProp()。</p> <button onclick="myFunction()">点我</button> <script> Number.prototype.myMet=function(){ this.myProp=this.valueOf()/2; } function myFunction(){ var d = new Number(55); d.myMet(); var x=document.getElementById("demo"); x.innerHTML=d.myProp; } </script> </body> </html>
运行结果