共 24 篇文章 |
|
JavaScript模板引擎 art-template.js 的使用。<div id="test-wrapper"> </div> <script id="test-template" type="text/html"> <h1>{{title}}</h1> </script>3、获取模板并往模板里插入数据。var data = { title: "hello world", desc: "... 阅417 转0 评0 公众公开 20-12-15 17:16 |
闭包是指有权访问另一个函数作用域中的变量的函数,创建闭包的常见的方式,就是在一个函数内部创建另一个函数,通过另一个函数访问这个函数的局部变量。私有变量 javascript没有私有属性的概念,所有的对象属性都是共有的,不过,却有一个私有变量的概念,任何在函数中定义的变量,都可以认为是私有变量,因为不能再函数的外部访问这些变量。 阅52 转0 评0 公众公开 20-12-15 11:03 |
深入理解 函数、匿名函数、自执行匿名函数1.基础概念:定义函数的方式。一般定义函数有两种方式:函数的声明,函数表达式1.1函数的声明。上面的函数表达式中的创建,实际上是创建一个匿名函数,并将匿名函数赋值给变量 add,用 add 来进行函数的调用,调用的方式就是在变量 add 后面加上一对括号(),如果有参数传入的话就是 add(1,2),这就是匿... 阅60 转1 评0 公众公开 19-11-08 16:05 |
IOS返回不刷新页面的解决办法。$(function () { var isPageHide = false;window.addEventListener(''''''''pageshow'''''''', function () { if (isPageHide) { window.location.reload();} });window.addEventListener(... 阅522 转2 评0 公众公开 18-10-04 21:43 |
js需要把时间戳转为为普通格式。function getLocalTime(nS) { return new Date(parseInt(nS) * 1000).toLocaleString().substr(0,17)} alert(getLocalTime(1293072805));function getLocalTime(nS) { return new Date(parseInt(nS) * 1000).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " "); } alert(getLoca... 阅26 转0 评0 公众公开 18-09-23 23:06 |
var start=1,//忽略第一行的表头 end=trs.length-1;//忽略最后合计的一行 var total=0; for(var i=start;i<end;i++){ var td=trs[i].getElementsByTagName(''''''''td'''''''')[column]; var t=parseFloat(td.innerHTML); if(t)total+=t; } trs[end].getElementsByTagName... 阅473 转2 评0 公众公开 18-06-20 11:01 |
$("#btn").click(function(){alert("1");$("#btn").click(function(){alert("2");$("#btn").on("click",function(){alert("1");$("#btn").unbind("click").click(function(){alert("2");$("#btn").unbind("click").... 阅423 转0 评0 公众公开 18-05-28 22:49 |
jq和js中click 事件的几种方式总结和click事件的累加问题解决办法。$("#btn").click(function(){alert("1");$("#btn").click(function(){alert("2");$("#btn").unbind("click").click(function(){alert("2");$("#btn").unbind("click").bind("... 阅1294 转1 评0 公众公开 18-05-28 22:46 |
$.ajax({ url: ''''''''{{ path_for(showDetail_item) }}'''''''', dataType: ''''''''json'''''''', data: {pid:position}, type: "GET", success: function (msg) { var url='''... 阅485 转1 评0 公众公开 18-05-22 13:50 |
// 验证字符串长度范围(字符串内只包含数字和/或英文字母)[若要验证固定长度,可传入相同的两个长度数值]function IsStringLengthOnlyNumberAndEnglishCharacter(input, LengthBegin, LengthEnd) { var pattern = ''''''''^[0-9a-zA-z]{'''''''' + lengthBegin + ''... 阅157 转3 评0 公众公开 18-05-18 11:54 |