js与jquery 学习随笔(一)
来源:互联网 发布:tensorflow下载教程 编辑:程序博客网 时间:2024/06/10 22:34
<html><meta http-equiv="Content-Type" content="text/html;charset=utf-8"/><head></head><script type="text/javascript" src="jquery.js"></script><script>function text_validate(maxlength,minlength){this.text;this.length;this.maxlength = maxlength;this.minlength = minlength;}text_validate.prototype.check = function(){var length = document.getElementsByTagName('textarea')[0].value.length;var frm = document.forms[0];if(length < this.minlength){alert('can not submit,less then');return false;}else if(length > this.maxlength){alert('more over');return false;}//frm.submit();}$(document).ready(function(){$('button').bind('click',handler);//bind方法})function handler(){var validate = new text_validate(100,10);validate.check();var sl_v = new select_validate();sl_v.check();sl_v.selectedValue();}function select_validate(){this.length;this.selectedValue;}select_validate.prototype.check = function(){var sl = document.getElementById('sl');var options = sl.options;var length = options.length;for(var i=0; i<length;i++){if(options[i].value == 'hello'){return false;}}var item = document.createElement('option');//功能类似于item.text = "你好";//$("#sl").append("<option value="hello">你好</option>")item.value = "hello";sl.add(item)options[length].selected = true;}select_validate.proptotype.selectedValue = function(){var sl = document.getElementById('sl');var options = sl.options;}</script><body><form action=""><textarea></textarea><button>bt</button><select id="sl"><option value="11">1</option><option value="22">2</option><option value="33">3</option></select></form></body></html>
- js与jquery 学习随笔(一)
- js与jquery 学习随笔(二)
- jquery学习随笔(一)
- js与jquery 学习随笔(三) 打印页面
- JQUERY 学习应用随笔一
- 页面元素选择一(jQuery学习随笔一)
- U2TP学习随笔(一)
- Socket学习随笔(一)
- c++学习随笔(一)
- JavaScript 学习随笔(一)
- 树莓派学习随笔(一)
- Python学习随笔(一)
- 机器学习随笔一:问题与挑战
- 【C++数据结构与算法】学习随笔一
- [学习随笔]并发编程与多线程一
- js随笔一
- JQuery选择器学习随笔
- JQuery学习随笔
- iphone应用程序本地化
- 如何在Linux上使用Bochs
- linux下bochs创建最简单的OS(一)
- MFC 界面假死问题解决方法
- hust 1607 Triangles 校赛 一个很好的题 hash
- js与jquery 学习随笔(一)
- Delegate
- XmlSerializer to XML and XML to object
- Safengine2.1.9.0
- android在拨号键盘输入类似*#*#0318#*#*的指令
- CString、TCHAR*、char*转换
- xcode:could not launch xxx
- 计算几何_多边形的有向面积和确保多边形的点是逆时针排列
- hdoj 1016经典问题素数环