随笔分类 -  JS知识点

摘要:问题背景: 在使用a标签下载文件时,download属性可以更改下载的文件 // 下载a.exe,并采用默认命名 <a href="/images/a.exe" download>点击下载</a> // 将a.exe改名为b.exe下载 <a href="/images/a.exe" downloa 阅读全文
posted @ 2024-05-29 16:52 study_php_java_C++ 阅读(1142) 评论(0) 推荐(0)
摘要:方式: 在url上添加参数,如果已经存在则替换 url = "http://www.test.com?a=1&b=2"const urlO = new URL(url); urlO.searchParams.set('redirectURL', url2); 阅读全文
posted @ 2023-03-09 09:24 study_php_java_C++ 阅读(130) 评论(0) 推荐(0)
摘要:1. nvm安装及使用参照: https://www.cnblogs.com/sunbenbao/p/16587644.html Node版本管理器--nvm,可以运行在多种操作系统上。nvm for windows 是使用go语言编写的软件。分享下在此操作系统上nvm的安装和使用。 主要用途: 切 阅读全文
posted @ 2022-12-14 16:37 study_php_java_C++ 阅读(382) 评论(0) 推荐(0)
摘要:demo: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>进度条属性上传</title> </head> <body> <form method="post" enctype="multipart/form-data"> <i 阅读全文
posted @ 2022-09-27 19:16 study_php_java_C++ 阅读(122) 评论(0) 推荐(0)
摘要:写一个js (function() { 'use strict'; const mWidth = 750; // 减少dom操作 const doc = document.documentElement; function resize(){ // 获取dom文档宽 const deviceWidt 阅读全文
posted @ 2022-06-23 13:37 study_php_java_C++ 阅读(33) 评论(0) 推荐(0)
摘要:<!-- 提示:如果你不想用form,你可以换成div等任何一个普通元素 --> <form class="layui-form"> <div class="layui-form-item"> <label class="layui-form-label">复选框</label> <div clas 阅读全文
posted @ 2022-06-21 10:32 study_php_java_C++ 阅读(1248) 评论(0) 推荐(0)
摘要:代码: <template> <div> <ul class="ulBox" id="ulBox"> <li class="li" :id="'id'+item" v-for="(item,index) in list" :key="index"> {{item}} </li> </ul> </di 阅读全文
posted @ 2022-06-20 13:01 study_php_java_C++ 阅读(337) 评论(0) 推荐(0)
摘要:1.jq-signature http://bencentra.github.io/jq-signature/ 支持的jquery版本低 2.HTML5 canvas http://www.htmleaf.com/Demo/201505281922.html 支持的jquery版本低 3. sign 阅读全文
posted @ 2021-06-18 16:37 study_php_java_C++ 阅读(401) 评论(0) 推荐(0)
摘要:官网文档: http://html2canvas.hertzen.com/ 使用的是 jquery 3.2.1 html2canvas 1.0.0-rc.7 截取根据id的指定区域: var canvasOtherTopHeight = $('.heading').height() + 31 + $ 阅读全文
posted @ 2021-06-18 11:48 study_php_java_C++ 阅读(3845) 评论(0) 推荐(0)
摘要:使用下面方法在监听普通的input的change事件正常 $('#pp').on('change', 'input.videos_poster_input', function () { console.log(' '); }) 以上代码在监听动态添加的input的事件就失效 可以采用以下方式:将父 阅读全文
posted @ 2021-06-18 10:52 study_php_java_C++ 阅读(1170) 评论(0) 推荐(0)
摘要:function getObjectURL(file) { var url = null; if (window.createObjectURL != undefined) { // basic url = window.createObjectURL(file); } else if (windo 阅读全文
posted @ 2021-06-18 09:57 study_php_java_C++ 阅读(403) 评论(0) 推荐(0)
摘要:$('video').trigger('play'); $('video').trigger('pause'); 判断video播放器的播放状态,并进行切换播放,需要这样 let video = $('video').get(0); if(video.paused) { video.play(); 阅读全文
posted @ 2021-06-04 18:07 study_php_java_C++ 阅读(992) 评论(0) 推荐(0)
摘要:window.frameElement 返回嵌入当前window对象的元素(比如 <iframe> 或者 <object>),如果当前window对象已经是顶层窗口,则返回null. var frameId = window.frameElement && window.frameElement.i 阅读全文
posted @ 2021-02-21 16:35 study_php_java_C++ 阅读(67) 评论(0) 推荐(0)
摘要:(function(){ var fnUrlReplace = function (eleLink) { if (!eleLink) { return; } var href = eleLink.href; if (href && /^#|javasc/.test(href) false) { if 阅读全文
posted @ 2021-01-21 10:01 study_php_java_C++ 阅读(448) 评论(0) 推荐(0)
摘要:可以使用encodeURIComponent():函数可把字符串作为 URI 组件进行编码。 可以使用decodeURIComponent():函数可把字符串作为 URI 组件进行解码。 阅读全文
posted @ 2020-06-22 16:19 study_php_java_C++ 阅读(352) 评论(0) 推荐(0)
摘要:如果无效用这个方法: on() 方法在被选元素及子元素上添加一个或多个事件处理程序。 <div id="zkdiv"> <input type="button" value="展开" id="zk" class="zk"/> <br> </div> $("#zkdiv").on("click",". 阅读全文
posted @ 2020-02-18 14:12 study_php_java_C++ 阅读(975) 评论(0) 推荐(0)
摘要:<script type="text/javascript"> var browser = { versions : function() { var u = navigator.userAgent, app = navigator.appVersion; return {//移动终端浏览器版本信息 阅读全文
posted @ 2020-01-16 14:58 study_php_java_C++ 阅读(454) 评论(0) 推荐(0)
摘要:$('iframe').contents().find(".btn").click(); 其中 contents(): 查找匹配元素内部所有的子节点(包括文本节点)。如果元素是一个iframe,则查找文档内容 阅读全文
posted @ 2020-01-13 16:30 study_php_java_C++ 阅读(2846) 评论(0) 推荐(0)
摘要:// 监听回车事件 判断是否属于是input激活状态下回车的window.onkeydown = function(e){ // elsinput是搜索框 if(e.keyCode 13 && elsinput.is(':focus')){ window.location.href = url + 阅读全文
posted @ 2019-11-08 15:16 study_php_java_C++ 阅读(1682) 评论(0) 推荐(1)
摘要:/^[\x{4e00}-\x{9fa5}\(\)()\da-zA-Z&]{2,50}$/u 上面是php匹配,变为js匹配很简单 /^[\u4e00-\u9fa5\(\)()\da-zA-Z&]{2,50}$/gi 因为有的公司带有 括号 和 & 或 数字 英文字符, 比如TCL,多奈鞋业(中国)有 阅读全文
posted @ 2019-10-29 10:16 study_php_java_C++ 阅读(6626) 评论(1) 推荐(0)