随笔分类 -  js

摘要:function compareDate(startDate, endDate) { var arr = startDate.split("-"); var starttime = new Date(arr[0], arr[... 阅读全文
posted @ 2014-04-24 16:17 偶不是大叔 阅读(206) 评论(0) 推荐(0)
摘要:摘录网上: var ddl = document.getElementById("DropDownList1");alert(ddl.selectedIndex);//选择索引值alert(ddl.options[ddl.selectedIndex].value);//绑定值alert(ddl.options[ddl.selectedIndex].text);//文本值 阅读全文
posted @ 2013-01-17 18:11 偶不是大叔 阅读(612) 评论(0) 推荐(0)
摘要:JS: //判定是单选还是全选var isMulti = "<% =Request.QueryString["mode"]%>"; //全选 function selectAll(ctlName, bool) { var ctl = document.getElementById(ctlName); var checkbox = ctl.getElementsByTagName('input'); for (var i = 0; i < checkbox.length; i++) { ... 阅读全文
posted @ 2012-11-12 18:24 偶不是大叔 阅读(358) 评论(0) 推荐(0)
摘要:前台Js var sReturn = window.showModalDialog(url, window, temp); if (typeof (sReturn) != "undefined") { document.getElementById("<%=btnsel.ClientID%>").click();//需要执行的操作 }子窗体的后台 ClientScript.RegisterStartupScript(Page.GetType(), "", "window.parent.returnValue=&# 阅读全文
posted @ 2012-09-02 13:51 偶不是大叔 阅读(1155) 评论(0) 推荐(0)
摘要:一:window.open()支持环境:JavaScript1.0+/JScript1.0+/Nav2+/IE3+/Opera3+二:语法:window.open(pageURL,name,parameters)其中:pageURL 为子窗口路径name 为子窗口句柄parameters 为窗口参数(各参数用逗号分隔)三:各项参数其中yes/no也可使用1/0;pixel value为具体的数值,单位象素。参数 | 取值范围 | 说明alwaysLowered | yes/no | 指定窗口隐藏在所有窗口之后alwaysRaised | yes/no | 指定窗口悬浮在所有窗口之上depend 阅读全文
posted @ 2012-07-25 11:08 偶不是大叔 阅读(449) 评论(0) 推荐(0)
摘要:js 弹出窗体语法及参数详解js: <script type="text/javascript"> function openEg(url, width, height, left, top) { var temp = "channelmode=no,location=no,menubar=no,toolbar=no,directories=no,scrollbars=no,resizable=no"; if (width) { temp += ',width=' + width; ... 阅读全文
posted @ 2012-07-25 11:03 偶不是大叔 阅读(258) 评论(0) 推荐(0)
摘要:当下面这种方法document.getElementById("txtMinute").value获取不到textbox文本值时,可以这样写:document.getElementById("<%=txtMinute.ClientID%>").value 阅读全文
posted @ 2012-07-23 15:35 偶不是大叔 阅读(539) 评论(0) 推荐(0)
摘要:区别:当文本框获得焦点时触发onfocus方法,而当焦点离开时则触发onblur方法。实例:<div> <asp:TextBox ID="TextBox1" runat="server" onblur="if(this.value==''){this.value='请输入日期';check();" onfocus="if(value =='ddd'){value =''}"></asp:TextBox> <as 阅读全文
posted @ 2012-07-22 21:18 偶不是大叔 阅读(897) 评论(0) 推荐(0)
摘要:下面介绍两种JS验证的方式:方法一:JS:<script language="javascript"> function check(){var a = /^(\d{4})-(\d{2})-(\d{2})$/if (!a.test(document.getElementById("TextBox1").value)) { alert("日期格式不正确!") return false } else return true } </script> HTML: <div> <asp:TextBox 阅读全文
posted @ 2012-07-22 20:42 偶不是大叔 阅读(79205) 评论(0) 推荐(5)
摘要:网上摘录简洁的js代码:HTML: 限制字数为:10 剩余字数:10网上拷贝的js代码: function getBalance(str) { var length = document.getElementById("txtcause").maxLength; ... 阅读全文
posted @ 2012-07-20 17:01 偶不是大叔 阅读(1819) 评论(0) 推荐(0)
摘要:<script type="text/javascript"> function userAgent(){ var ua = navigator.userAgent; ua = ua.toLowerCase(); var match = /(webkit)[ \/]([\w.]+)/.exec(ua) || /(opera)(?:.*version)?[ \/]([\w.]+)/.exec... 阅读全文
posted @ 2012-03-26 15:07 偶不是大叔 阅读(254) 评论(0) 推荐(0)
摘要://userinfo是from表单名(name),email是文本框名(name) if(document.userinfo.email.value.length!=0) { if (document.userinfo.email.value.charAt(0)=="." || document.userinfo.email.value.charAt(0)=="@"|| document.userinfo.email.value.indexOf('@', 0) == -1 || document.userin... 阅读全文
posted @ 2012-02-03 13:15 偶不是大叔 阅读(1638) 评论(0) 推荐(0)