JS获取当前时间戳的方法 //方法一 var timestamp = (new Date()).getTime(); console.log(timestamp); //1495302061441 //方法二 var timestamp2 = (new Date()).valueOf(); console.log(timestamp2); //1495302061447
html js绑定键盘按键触发事件(按回车键登陆) document.onkeydown =cdk; function cdk(){ if(event.keyCode ==13){ submit(); } } function keyboard() { document.onkeydown = function() { let keycode = event.keyCode; if (keycode == 32) { alert("空格键被按下了"); } } } keyboard(); function keyboard(event) { let keycode = event.keyCode; if (keycode == 32) { alert("空格键被按下了") } } //参数1:表示事件,keydown:键盘向下按;参数2:表示触发的事件处理函数 document.addEventListener("keydown", keyboard);
html-屏蔽按键盘空格键是滚动条向下滚动 document.onkeydown = function(ev){ var e = ev || event; if(e.keyCode == 32){ return false; } } $(document).keydown(function(event) { if (event.target.nodeName == 'TEXTAREA' || event.target.nodeName == 'INPUT') { return; }; /* Act on the event */ if (event.keyCode == 32) { event.preventDefault(); alert(1) }; }); document.body.onkeydown = function (event) { var e = window.event || event; if(e.preventDefault){ e.preventDefault(); }else{ window.event.returnValue = false; } }
jQuery
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script src="https://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
Vue的CDN引入:
<!– 开发环境版本,包含了有帮助的命令行警告 –>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.11/vue.min.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://unpkg.com/axios@0.21.1/dist/axios.min.js"></script>
axios.get(post_url,{userid:user,data:url}).then(res => {
var dataobj = res.data
})
如果CDN加载失败时,我们需要加载自己本地的jQuery文件,只需要在头部加上下面的代码就可以
<script>window.jQuery || document.write('<script src="js/jquery-1.11.1.min.js" type="text/javascript"><\/script>')</script>
百度CDN 支持版本:2.0.3, 2.0.2, 2.0.1, 2.0.0,1.11.1, 1.10.2, 1.10.1, 1.10.0, 1.9.1, 1.9.0, 1.8.3, 1.8.2, 1.8.1, 1.8.0, 1.7.2, 1.7.1, 1.7.0, 1.6.4, 1.6.3, 1.6.2, 1.6.1, 1.6.0, 1.5.2, 1.5.1, 1.5.0, 1.4.4, 1.4.3, 1.4.2, 1.4.1, 1.4.0, 1.3.2, 1.3.1, 1.3.0, 1.2.6, 1.2.3 <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
jQuery官方CDN 支持版本:2.1.1, 2.0.3, 2.0.2, 2.0.1, 2.0.0, 1.10.2, 1.10.1, 1.10.0, 1.9.1, 1.9.0, 1.8.3, 1.8.2, 1.8.1, 1.8.0, 1.7.2, 1.7.1, 1.7.0, 1.6.4, 1.6.3, 1.6.2, 1.6.1, 1.6.0, 1.5.2, 1.5.1, 1.5.0, 1.4.4, 1.4.3, 1.4.2, 1.4.1, 1.4.0, 1.3.2, 1.3.1, 1.3.0, 1.2.6, 1.2.3 <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
Highcharts 百度CDN 支持版本:2.3.5, 2.2.5 <script src="http://libs.baidu.com/highcharts/2.2.5/highcharts.js"></script>
原文链接:https://blog.csdn.net/qq_43532342/article/details/111907277?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522165918418816782395376867%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fblog.%2522%257D&request_id=165918418816782395376867&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~blog~first_rank_ecpm_v1~times_rank-28-111907277-null-null.nonecase&utm_term=cdn%E5%8A%A0%E9%80%9F
原创文章,作者:优速盾-小U,如若转载,请注明出处:https://www.cdnb.net/bbs/archives/426