随笔分类 -  JS_01_Base

摘要:1 on(events,fn) 绑定事件 2 off(events,fn) 解除绑定 3 addClass() 4 removeClass() 阅读全文
posted @ 2017-02-27 11:18 roscee 阅读(130) 评论(0) 推荐(0)
摘要:1 让input 等不可点击onFocus="this.blur()" 阅读全文
posted @ 2015-07-04 11:42 roscee 阅读(174) 评论(0) 推荐(0)
摘要:在1.8版本前jquery 的全局函数需要绑定到具体的DOM对象之上在1.8版本之后,需要绑定到Document 对象之上var $doc = $(document);$doc.ajaxComplete(function(event,xhr,options){ var str_timeout ... 阅读全文
posted @ 2015-06-05 14:15 roscee 阅读(5417) 评论(0) 推荐(0)
摘要:在javaScript 中返回HTML的时候,如果HTML中涉及到的JS函数参数需要用单双引号 HTML 转义 双引号:" IE6/8等浏览器下可能不识别 可以用十进制字符 》" 单引号:' 对应十进制字符 》 ' 在js 中涉及到的单双引号转义,可以用 \' 和 阅读全文
posted @ 2015-05-29 15:43 roscee 阅读(1046) 评论(0) 推荐(1)
摘要:$(".textareashow").each(function(i){ var content = $.trim($(this).text()); var newcontent = content.replace(/\n/g,''); $(this).html(newcontent);... 阅读全文
posted @ 2015-01-28 14:23 roscee 阅读(544) 评论(0) 推荐(0)
摘要:上面的这种用的是方法类,大方法是register,里面定义的二个小方法,一个是对用户名的check,一个是对密码的check.个人觉得通过域,来对function进行管理,规划最简单明了。 阅读全文
posted @ 2014-10-08 21:21 roscee 阅读(684) 评论(0) 推荐(0)
摘要:一: 事件: 初始化函数中: //禁用回车 后退事件 document.onkeydown = function () { if (window.event && (window.event.keyCode == 13 || window.event.keyCode== 8)) { window.e 阅读全文
posted @ 2014-07-11 17:56 roscee 阅读(1215) 评论(0) 推荐(0)
摘要:匹配负整数的正则表达式: -[0-9]*[1-9][0-9]*匹配整数的正则表达式: -?\\d+匹配非负浮点数(正浮点数 + 0)的正则表达式: \\d+(\\.\\d+)?匹配正浮点数的正则表达式: (([0-9]+\\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*... 阅读全文
posted @ 2014-06-25 11:03 roscee 阅读(390) 评论(0) 推荐(0)
摘要:方式一:var memberA={name:"tony",age:25,objpropname:{propName1:value1,propName2:value2},};方式二:自定义一个建构函数,然后和第一种方式一样用new来创建function funcName( param1,param2,... 阅读全文
posted @ 2014-05-28 08:34 roscee 阅读(154) 评论(0) 推荐(0)
摘要:页面代码:function test(){ $.ajax({ type:'post', timeout:8000, url:'json/testJson.htm', data:{"name":"zzd","sex":"man"}, //dataType:'text', dataType:'json', success:function(data){ /*var json = eval('('+data+')'); $(& 阅读全文
posted @ 2014-03-18 17:05 roscee 阅读(303) 评论(0) 推荐(0)
摘要:男女 篮球 足球 乒乓球 =========================================================================================一、获得dom 元素(选择器) 1 $("#id") $("#id") 2 $(.class) $(".sheet") 3 $([attribute=value]) $("input[name='name']") $("") ""内的内容是jquery 的选择 阅读全文
posted @ 2013-12-17 22:31 roscee 阅读(279) 评论(0) 推荐(0)
摘要:1 打开子窗口。window.open('jrsManage_initAddJrs.action','window',"height=600, width=850, top=130, left=400,toolbar=no, menubar=no, scrollbars=no, resizable=... 阅读全文
posted @ 2013-11-08 15:59 roscee 阅读(773) 评论(0) 推荐(1)
摘要:服务器端拼接json格式的字符串:String string = "{\"name\":"+@parm+",\"sex\":"+@sex+"}";\\键值对除了数值型都要加引号response.getWriter.writer(string);//[echo $string;]浏览器端接收参数:1:var obj = eval("("+data+")")//方式一不安全2:在$ajax()方法中指明dataType:"json" 在回调 阅读全文
posted @ 2013-01-30 14:29 roscee 阅读(163) 评论(0) 推荐(0)
摘要:function ajax(){$.get( "url", {"name":"zhangsan","sex":"man"}//json 格式传送参数 function(result){//result(可重命名) 为返回结果 $("#id").html(result); })}get和post的区别在于参数的长度、和浏览器的缓存function ajax(){$.ajax({ type:"get/post", url:"url", da 阅读全文
posted @ 2013-01-30 13:27 roscee 阅读(270) 评论(0) 推荐(0)
摘要:JavaScript 中:function ajax(){var xmlHttpRequerst;try{ xmlHttpRequest = new XMLHttpRequest(); // code for IE7+, Firefox, Chrome, Opera, Safari}catch(e){xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");// code for IE6, IE5}//执行xmlHttpRequest.onreadystatechange(function(){if(xmlHttpReq 阅读全文
posted @ 2013-01-30 11:20 roscee 阅读(177) 评论(0) 推荐(0)