随笔分类 - JS技能
js技能笔记
摘要:!window.opener:这部分检查window.opener是否存在。 如果window.opener是null或undefined,则!window.opener为true。 window.opener可能不存在的情况包括: 当前窗口不是由另一个窗口打开的(例如,直接在地址栏输入URL或通过
阅读全文
摘要:window.open(document.location, 'big', 'fullscreen=yes'); js <script type="text/javascript"> /* 创建一个事件对象,名字为newEvent,类型为HTMLEvent */ var newEvent = doc
阅读全文
摘要:1,
阅读全文
摘要:1, // 这是定义一个对象 const nonExtensible = { removalbe: true }; // 这是通过preventExtensions方法令指定对象无法再添加新的属性 Object.preventExtensions(nonExtensible); // 如果此时添加对
阅读全文
摘要:1, // null:返回 0 console.info(+null) // => 0 // undefined:返回 NaN console.info(+undefined) // => NaN // 获取当前的时间戳,相当于`new Date().getTime()` console.info(
阅读全文
摘要:function makeTextSprite(message, parameters) { if (parameters undefined) parameters = {} let fontface = parameters.hasOwnProperty("fontface") ? parame
阅读全文
摘要:1, 一,使用 TextGeometry创建3D文字 1.需加载字体配合使用,使用THREE.FontLoader // 加载字体 loadFont() { return new Promise(function (resolve, reject) { const loader = new THRE
阅读全文
摘要:1, console.log('%c Refer验证中,请勿非法请求拦截中', 'color:red;font-size:1.2em')
阅读全文
摘要:1, <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset="utf-8"> <title>展示模型</title> <meta name="viewport" content="width=device-width, initial-sc
阅读全文
摘要:1,通过京东接口获取北京时间 $.ajax({ type: "POST", dataType: "jsonp", url: 'https://f.m.suning.com/api/ct.do', success: function (json) { console.log(json); } });
阅读全文
摘要:1,输入空格 \xa0 2, js字符串拼接空格拼不上 一个很简单拼接字符串,弄的自己都自闭了,需求两个字符串date:2019-11-28,time:17:50,拼接成2019-11-28 17:50,就是简单的加个空格,但是被自己的编译器自动规范代码的插件给坑了,撸完ctrl+s时,自动把我空格
阅读全文
摘要:1, // 禁止双指缩放触发浏览器缩放 document.documentElement.addEventListener('touchstart', function(event) { if (event.touches.length > 1) { event.preventDefault();
阅读全文
摘要:1,html 代码 <div class="in-banner case_inbanner"> 2,JS代码 <script type="text/javascript" src="public/static/js/polygonizr.min.js"></script> <script type=
阅读全文
摘要:1,获取时间字符串 var nowdatestr = new Date().toLocaleDateString(); 获取时间格式如:2022/10/10 2,计算时间差 $nowdate=date('Y-m-d H:i:s',time()); $ret['leftdays']=floor((st
阅读全文
摘要:1, // 清除iframe内存 var frame = $('#iframe'); if(frame && frame[0]) { frame[0].src = 'about:blank'; //src地址置空 frame[0].contentWindow.document.write('');
阅读全文
摘要:1, 这是jquery-1.10.2.js 文件,其中跳转到另一个公共库加载另一个js文件 /*-防止各大cdn公共库加载地址失效问题,此地址我们会时时监控,及调整以保障正常访问-www.jq22.com为您服务*/ /*当前为字节跳动cdn公共库提供的jQuery-1.10.2*/ documen
阅读全文