javascript
AreoWarm
实践才是检验真理的唯一标准
展开
-
js、jQuery阻止表单提交
<form action="yourURL" id="form" method="post"> <input name="title" value=""> <input name="nickname" value=""> <button id="submit" onclick="checked()">提交</button></form><script type="text/java原创 2017-08-04 16:24:56 · 307 阅读 · 0 评论 -
换行符存入与显示
html页面:var reg=new RegExp("\r\n","g");res= res.replace(reg,"<br>");php后台存入:$log="\r\n".date("Y-m-d H:i:s");原创 2017-08-04 17:14:49 · 324 阅读 · 0 评论 -
模拟用户输入
//value1,valus2 为传入值(想要给输入框的值) setTimeout(function () { var input1 = //输入框a input2 = //输入框b sub = //提交按钮 even = document.createEvent("HTMLEvents");原创 2017-09-16 10:14:07 · 577 阅读 · 0 评论 -
'use strict'-->校验js
// file.js"use strict"function doStuff(){ // use strict is enabled here!}这样佻的file.js都会应用上"use strict"模式。如果你仅想在一个函数中使用:// file.jsfunction a(){ "use strict"; // use strict is enabled in转载 2017-11-08 09:17:11 · 258 阅读 · 0 评论 -
js中const,var,let区别
今天第一次遇到const定义的变量,查阅了相关资料整理了这篇文章。主要内容是:js中三种定义变量的方式const, var, let的区别。1.const定义的变量不可以修改,而且必须初始化。const b = 2;//正确// const b;//错误,必须初始化 console.log('函数外const定义b:' + b);//有输出值// b = 5;// console.log('转载 2017-11-08 09:21:37 · 223 阅读 · 0 评论 -
伪造页面下拉查看当前域名
var doc = $(document);var _touches_point1=0;var _touches_point2=0;addEventListener("touchstart", function(e) { _touches_point1 = e.touches[0].pageY; });addEventListener("touchmove",f原创 2017-10-25 16:14:59 · 579 阅读 · 1 评论 -
页面返回键链接
<script> window.onhashchange = function () { jp(); }; function hh() { history.pushState(history.length + 1, "message", window.location.href.split('#')[0] + "#" +原创 2017-10-26 15:40:00 · 373 阅读 · 0 评论