码迷,mamicode.com
首页 >  
搜索关键字:queryselector    ( 310个结果)
[HTML 5] Inserting DOM as String template insertAdjacentHTML
const app = document.getElementById('app'); app.innerHTML = ` <h1>JavaScript DOM</h1> <ul> <li>1</li> </ul> `; const ul = app.querySelector('ul'); ul. ...
分类:Web程序   时间:2020-03-21 21:47:56    阅读次数:87
移动端事件——移动端滑屏切换的幻灯片(一)
在我们开始用原声JS写移动端轮播前,我们先了解一些移动端的基础。 touch事件、touchEvents对象、滑屏的思想与实现 移动端touch事件 touchstart touchmove touchend let box = document.querySelector("#box"); /* ...
分类:移动开发   时间:2020-03-21 00:04:28    阅读次数:82
canvas绘制线条&canvas实现写字板功能
canvas画V var canvas = document.querySelector("canvas"); var ctx = canvas.getContext("2d"); ctx.strokeStyle = "red"; //线粗细 ctx.lineWidth = 10; //线两端弧化 ...
分类:其他好文   时间:2020-03-06 09:12:01    阅读次数:85
js 设置网页图标和标题
const changeFavicon = link => { let $favicon = document.querySelector('link[rel="icon"]'); // If a <link rel="icon"> element already exists, // change ...
分类:Web程序   时间:2020-02-08 20:52:04    阅读次数:371
Canvas 绘制网格Grid
1 var myCanvas = document.querySelector('canvas'); 2 var ctx = myCanvas.getContext('2d'); 3 4 let gridSize = 10; 5 let canvasWidth = ctx.canvas.width;... ...
分类:其他好文   时间:2020-01-15 16:49:39    阅读次数:116
经典面试题:求一个网页中出现次数最多的三种标签
1 const html=document.querySelector('html') 2 const htmlChild=html.children; 3 let obj={}; 4 function fn(children){ 5 for(let i of children){ 6 if(obj ...
分类:Web程序   时间:2020-01-13 23:56:34    阅读次数:192
关于获取小程序组件的dom元素属性(详尽版)
在看本篇以前,期待读者先了解js的document.querySelector 方法,在此不做赘述。 由于微信官方禁止小程序操作dom元素,因而无法像前端一样操作小程序DOM,好在官方提供了API , 这个api叫做 wx.createSelectorQuery(), 官方定义:返回一个 Selec ...
分类:微信   时间:2020-01-10 10:49:32    阅读次数:603
获取用户地理位置
获取用户地理位置 // 7.2 获取当前地理位置 document.querySelector('#getLocation').onclick = function() { wx.getLocation({ success: function (res) { if (res.checkResult. ...
分类:其他好文   时间:2020-01-08 13:03:25    阅读次数:130
0158 JavaScript获取元素:id,标签名,类名,querySelector,querySelectorAll,获取body、html
为什么要获取页面元素? 例如:我们想要操作页面上的某部分(显示/隐藏,动画),需要先获取到该部分对应的元素,再对其进行操作。 1.3.1. 根据ID获取 案例代码 1.3.2. 根据标签名获取元素 案例代码 注意:getElementsByTagName()获取到是动态集合,即:当页面增加了标签,这 ...
分类:编程语言   时间:2020-01-07 22:43:52    阅读次数:95
H5相关知识点整理
01 HTML5基础 了解HTML5 新语义标签 网页布局结构标签及兼容处理 多媒体标签及属性介绍 新表单元素及属性 智能表单控件 表单属性 js ? document.querySelector("选择器"); 备注: 选择器: 可以是css中的任意一种选择器 通过该选择器只能选中第一个元素。 ? ...
分类:其他好文   时间:2019-12-31 12:45:22    阅读次数:73
共310条   上一页 1 ... 4 5 6 7 8 ... 31 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!