2015-11-4更新:自己重写jqueryui datepicker的_gotoToday私有方法也行$.datepicker._gotoToday = function (id) { $(id).datepicker('setDate', new Date()).datepicker('hide').blur();}; jqueryui的datepicker插件点击今天按钮时,只是跳转到当天所在的月份,而不是设置控件的值为今天。要想点击今天这个按钮后设置..
javascript正则对象RegExp参数,正则对象方法RegExp.compile参数说明 RegExp对象使用方法new RegExp(pattern, attributes);参数pattern:字符串或者正则表达式,如果是字符串,注意字符需要转义。DEMOscript //参数为数字 var re = new RegExp(\\d{4}, 'g'); alert(re)// == /\d{4}/g re = new RegExp(\d{4}, '..
javascript以变量式申明函数时,如果函数有函数名称,这个函数名称作用域范围将会在此函数体有效,作为私有变量存在,非全局变量。 DEMOscript var b = function c() { a = 1; b = 2; c = 3; } b(); console.log(a); console.log(b); console.log(c);//报错/script 解析:函数内的a,b,c没..
The Object.defineProperties() method defines new or modifies existing properties directly on an object, returning the object.SyntaxObject.defineProperties(obj, props)ParametersobjThe object on which to define or modify properties.propsAn object whose own enumerable properties constitute descriptors for the properties t..
javascript解码\x\u格式的16进制编码。script function hexToString(str) { var mc = str.match(/\\x[a-z\d]{2}|\\u[a-z\d]{4}/gi); var val = ''; for (var i = 0, j = mc.length; i j; i++) { val += String.fromCharCode(parseInt(mc[i].substring(2), 16)); } return val; ..
JavaScript数字滚动效果 div id=n style=height:20px div class=num1/div div class=num2/div div class=num3/div div class=num4/div div class=num5/div div class=num6/div div class=num7/div div class=num8/div div class=num9/div div class=num10/div ..
javascript utf-8,unicode(utf-16)编码相互转换源代码 //javascript将UTF-16字符串转转换为UTF-8字符串 function utf16ToUtf8(s){ if(!s){ return; } var i, code, ret = [], len = s.length; for(i = 0; i len; i++){ code = s.charCodeAt(i); ..
javascript加载xml文件源代码 /* 通过ajax加载xml文件,返回xml dom对象 备注:chrome浏览器下请求本地xml文件会报XMLHttpRequest cannot load file:///xxxxx.xx. Cross origin requests are only supported for HTTP,需要搭建服务器 */ function LoadXML(url) { var xhr = window.ActiveXObject ? new ActiveXObject..