随笔分类 - JavaScript
摘要:function isIdCard(code: string) { if (code.length !== 18) return false; const reg = /^(11|12|13|14|15|21|22|23|31|32|33|34|35|36|37|41|42|43|44|45|46|
        阅读全文
                
摘要:Math数学函数 Math是数学常数属性和数学函数方法,Math不是一个函数对象,它只用于Number类型,不支持BigInt 与其它全局对象不同的是,Math 不是一个构造器。Math 的所有属性与方法都是静态的。Math 的常量是使用 JavaScript 中的全精度浮点数来定义的。 属性 Ma
        阅读全文
                
摘要:function selected(id, val) { $('#' + id + ' option[value="' + val + '"]').attr('selected', true); }
        阅读全文
                
摘要:1、先添加一个js文件,把以下代码复制进去:(jquery.downCount) (function ($) { var interval; $.fn.downCount = function (options, callback) { var settings = $.extend({ date:
        阅读全文
                
摘要://浏览器关闭或刷新事件 function bindCloseBrowser() { var a = "注意!!\n您即将离开页面!离开后可能会导致数据丢失\n\n您确定要离开吗?"; window.onbeforeunload = function (b) { b = b || window.event; b.returnValue = a; ...
        阅读全文
                
摘要:function SetCookie(name, value) { var Days = 1;//保留天数 var exp = new Date(); exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000); document.c...
        阅读全文
                
摘要:1 //yyyy-MM-dd HH:mm:SS 2 function JsonDateToDate(jsondate) { 3 var date = new Date(parseInt(jsondate.replace("/Date(", "").replace(")/", ""), 10)); 4
        阅读全文
                
摘要:1、在input输入数据时执行的事件(边输入边触发事件) 2、关闭浏览器事件
        阅读全文
                
摘要:隐藏转跳,浏览器不产生历史记录(replace)。代码片段: 当然我们还不能忘记常用的a标签(href)。代码片段:
        阅读全文
                
摘要:1,tabs获得被选中的标题 2、当设置checkbox时用attr设置是否选中时,第一次能选中,但是第二次就无法被选中了,那么就用prop
        阅读全文
                
摘要:设置或获取对象指定的文件名或路径。window.location.pathname例:http://localhost:8086/topic/index?topicId=361alert(window.location.pathname); 则输出:/topic/index设置或获取整个 URL 为
        阅读全文
                
                    
                
浙公网安备 33010602011771号