JS
如何让JS实现类似PHP的 __set __get方法?
html
<input type="text" id="ipt1" name="username" value="1" _tipsTxt="提示内容" /> <script type="text/javascript"> var username = document.getElementById('ipt1'); alert(username._tipsTxt); alert(username._maxLen); //这些类似 _maxLen 是不确定的 </script>
属性
javascript
prototype
估计你是想要这个: