![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
JavaScript
PerfectUrl
PHP 项目开发,Go项目开发
展开
-
JavaScript只允许输入正整数
<tdbgcolor="#FFFFFF"width="90%"style="font-size:16px;"><inputtype="text"name="in1"value="1991"onkeyup="value=value.replace(/[^\d]/g,'')">原创 2017-04-05 14:45:42 · 711 阅读 · 0 评论 -
按钮点击限时
var countdown=10;function settime(val){ if(countdown==0){ val.removeAttribute("disabled"); val.value='获取验证码'; countdown=10; return;//这里必须跳出循环,不然一直循环 }else{ v翻译 2017-05-08 11:09:08 · 453 阅读 · 0 评论 -
js 在多个按钮中获取点击按钮的id值
window.onload = function(){ var arr = document.getElementsByTagName('button'); for(var i = 0;i<arr.length;i++){ arr[i].onclick = function(){ alert(this.id);//this是关键点 } }转载 2017-05-10 10:30:17 · 4977 阅读 · 3 评论 -
javasctipt setInterval()用法
00 天00 时00 分00 秒function getRTime(){var EndTime= new Date('2017/06/07 09:00:00'); //截止时间var NowTime = new Date();var t =EndTime.getTime() - NowTime.getTime();var d=Math.floor(t/100原创 2017-05-31 18:40:04 · 1563 阅读 · 0 评论 -
jquery 对select中option的移动删除
/** * 向上移动选中的option */function upSelectedOption(){ if(null == $('#where').val()){ alert('请选择一项'); return false; } //选中的索引,从0开始 var optionIndex = $('#where').get(0).selectedIndex; /翻译 2017-05-20 22:51:52 · 439 阅读 · 0 评论 -
js 手机触屏滑动置顶
$(function(){ var Width =document.documentElement.clientWidth;//取得手机屏幕宽度 var Height = document.documentElement.clientHeight;$(document).on('touchmove',function(){//将文档绑定手机滑屏事件var TopV原创 2017-07-11 14:17:07 · 566 阅读 · 0 评论 -
web消除用户的后退操作
//防止页面后退 history.pushState(null, null, document.URL); window.addEventListener('popstate', function () { history.pushState(null, null, document.URL); });翻译 2017-07-31 09:29:55 · 344 阅读 · 0 评论 -
JS对象继承
function inheritPrototype(subType,superType){ var prototype = object(superType.prototype); prototype.constructor = subType; //将原型指向sub对象 subType.prototype = prototype;}function object(o)原创 2017-11-21 17:46:32 · 249 阅读 · 0 评论