ITeye博客

js

共 8 篇文章

标签data-*属性使用

<div class="page_index" style="margin-top:20px;"> <span id="showPage">第2页</span> <span id="totalPage" data-size="4">共4页</span> <a id="first" onclick="getPage(this)" href="javascript:void(0)"> message.first.page </a> <a id="previous" onclick="getPage(this)" href="javascript:void(0)">[上一页] </a> <a id…

2016-07-01 13:06 · js · web front end

分页总页数计算公式

//total : 总数 //pageSize : 每页显示数 //totalPage : 共页数 var totalPage = (total + pageSize - 1)/pageSize;

2016-06-24 16:40 · js · web front end

eclipse工程加入jquery.min.js报错:missing semicolon

1,注释修改项目目录下的.project文件 <?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>FlexPaper</name> <comment></comment> <projects> </projects> <buildSpec> <!-- <buildCommand> <name>org.eclipse.wst.jsdt.core.javascriptValidator</name> <arguments> </arguments> </buildCommand> --> <buildCommand>…

2016-05-25 16:50 · js · eclipse

setInterval对某个数值加加渐减

decrease_time = setInterval(decrease_opacity_val,10); function decrease_opacity_val(){ showID.style.opacity = showID.style.opacity - 0.01; if(showID.style.opacity == 0) { clearInterval(decrease_time); showID.style.display = "none"; showID.style.opacity = ""; leftID.style.display = "block"; leftID.s…

2016-03-29 13:42 · js

js去空格

var content = Dom.get("mail_content").value.replace(/(^\s*)|(\s*$)/g,'');//去前后空格 //replace(/\s/ig,'');去全部空格

2015-09-17 16:31 · js · web front end

js判断时间差

//var startDate = "2015-09-09"; //var endDate = "2015-09-08"; var startDate = "2015-09-09 15:09:04"; var endDate = "2015-09-09 15:09:05"; alert(new Date(startDate.replace(/\-/g, '\/')) - new Date(endDate.replace(/\-/g, '\/')));//以毫秒为单位,返回startDate与endDate时间差

2015-09-10 17:37 · js · web front end · JS

JS采用正则表达式简单获取URL地址栏参数

GetUrlParam:function GetUrlParam(param){ var reg = new RegExp("(^|&)"+ param +"=([^&]*)(&|$)"); var r = window.location.search.substr(1).match(reg); if(r!=null)return unescape(r[2]); return null; }, param:传入参数名字 例: var docId = "101"; var randnum = Math.random(); url="../page/jtformat?docId="+docId+…

2015-07-15 17:49 · js · JS

js判断字符是否包含字母汉字

<script type="text/javascript"> function check(str) { if (escape(str).indexOf("%u")!=-1){ alert("不能含有汉字"); } if(str.match(/\D/)!=null){ alert('不能含有字母'); } } </script>

2015-05-13 08:27 · js