function dateCompare(startStr,endStr) { var d1, d2, s, arr, arr1, arr2; if(startStr.length > 10) { arr = startStr.split(" "); arr1 = arr[0].split("-"); arr2 = arr[1].split(":"); d1 = new Date(arr1[0], arr1[1] - 1, arr1[2], arr2[0], arr2[1], arr2[2]); } else { arr = startStr.split("-"); d1 = new Date(arr[0], arr[1], arr[2]); } if(endStr.length > 10) { arr = endS...
by fucuihong - Java文档中心 - 2009-04-30 14:24:09 阅读(759) 回复(0)
有两个页面,是嵌套关系,例如a页面中iframe的形式嵌套b,在a中定义了一个标签:
,b页面加载的时候会取到传给a的值,b中赋值如下:window.top.content.document.getElementById("print_body").innerHTML = "$printbody"; $printbody是个变量。 需要实现的功能就是将b中获取的参数$printbody值传递给a。 遇到的情况:当$printbody内容很少的情况下,这样是没问题的,能正常传递,但...
[code][/code] [code][/code] [ 本帖最后由 yttlovezxx 于 2006-7-20 09:21 编辑 ]
比如:
123456789 |
123456789 |
今天才发觉新问题, 中文js也判断为一个字,因为是用的utf-8 这是个问题呀,比如我的会员名要求在4-16个英文字符,或2-8个中文字符,反正就是一个中文字符抵两英文,实际上在数据库中的字节也是这样的. 问题是我在表单中提交验证时,发觉js只把一个中文字当一个字符长, 比如 alert("测试".length) 结果是2 郁闷呀,难道要用正则之类把所有的中文分出来计算长度???这个可麻烦了哟.大家都我一个好办法,如果确要全部搜索出来单独算,正则如何...
script language="javascript"> String.prototype.mytrim = function() { return this.replace(/(^\s*)|(\s*$)/g, ""); } String.prototype.myLTrim = function() { return this.replace(/(^\s*)/g, ""); } String.prototype.myRTrim = function() { return this.replace(/(\s*$)/g, ""); } function checkSubmit(){ var beginTime =document.getElementById("beginTime").value.mytrim(); ...
几个js 里面的小秘密,用标签分割 以前从来没想过“下拉列表”居然也有分组的属性~~真是很兴奋~~,实际上和软件的某些功能已经很相像啦~~用法 举例如下: 代码: 1-1 1-2 2-1 2-2 3-1 3-2 拖动鼠标放大图片的js function img_onmousewheel(o) { var zoom = parseInt(o.style.zoom, 10) || 100; zoom += event.wheelDelta / 12; if (zoom > 0) o.style.zoom = zoom...
在页面建立js代码: script language="JavaScript" type="text/JavaScript"> /*=======Calendar.js=======By Jiang Hongbin=======*/ var months = new Array("一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"); var daysInMonth = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); var days = new Array("日","一", "二", "三", "四", "五", "六"); var toda...
随机效果文本-定时的从一段文本中随机选择一个字符,改变颜色 ripple text examples by mark boyle email mboil@hotmail.com var speed = 20; var fulltext; if(navigator.appname == "netscape") document.write( ); if (navigator.appversion.indexof("msie") != -1) document.write( ); function livetext() { fulltext="this is an example of random effect text" var whichchar=math.round(...