use*_*081 6 javascript forms prototype
有没有机会在Form对象上使用原型,这是行不通的:
Form.prototype.myFunc=function()
{
alert('OK!');
}
Run Code Online (Sandbox Code Playgroud)
另一方面,String对象是可扩展的,例如:
String.prototype.trim = function() {
return this.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
Run Code Online (Sandbox Code Playgroud)
如果你的意思HTMLFormElement,那应该是
HTMLFormElement.prototype.myFunc=function() {
alert('OK!');
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1646 次 |
| 最近记录: |