[html-10]html+css+js的小知识,js源码,制作网页临时用到的素材,其它知识备忘。

[html-10]html+css+js的小知识,js源码,制作网页临时用到的素材,其它知识备忘。 js源码素材里面有一些占用内存极小的视频用于测试网页视频播放控件还有js源码。https://www.123684.com/s/kCZzVv-Ca1W3便于复制alertinset:0//文本textContent//元素innerHTMLstylewidth:100%styledisplay:noneonclickthis.nextElementSibling.style.displayblockconstadocument.createElement(a);a.href语言字符/0.html;a.click()一些小技巧你可能看不懂添加点击事件如果要用event必须要写。document.querySelector(a).onclickfunction(event){替换元素下的所有图片后缀。this.querySelectorAll(img).forEach(aa.srca.src.replace(/\.[^.]$/,.jpg))获取自己点击的是哪一个返回序号从零开始不能用const因为无法使用自增运算符。leta[...this.children].findIndex(aa.contains(event.target))后置自增运算符先用0后面要使用:nth-child()所以要从1开始。document.querySelector(a).innerHTMLz[a];如果无法获取js将跳转至备用地址。按照标准前面一律带上window.。script srcindex.jsonerrorwindow.location.hrefhttps://blog.csdn.net/2301_81608124/script销毁自己并载入js已压缩至最小。div onclick(a{this.remove();a.src0.js;document.body.appendChild(a)})(document.createElement(script))有些代码怕自己忘记写在这里能在一秒后跳转到指定网站中meta http-equivrefreshcontent1;urlhttps://developer.mozilla.org读取另一个文件夹里的图片content:url(../mod/0.jpg)变量b输入代码能够执行newFunction(b)()获取选项内容select onchangealert(this.options[this.options.selectedIndex].text)option空空1/optionoption空空2/optionoption空空3/optionoption空空4/optionoption空空5/optionoption空空6/optionoption空空7/optionoption空空8/optionoption空空9/optionoption空空10/option/select获取value内容select onchangealert(this.value)option valuea1空空1/optionoption valuea2空空2/optionoption valuea3空空3/optionoption valuea4空空4/optionoption valuea5空空5/optionoption valuea6空空6/optionoption valuea7空空7/optionoption valuea8空空8/optionoption valuea9空空9/optionoption valuea10空空10/option/select一些获取a onclickalert(this.text)元素内的文本内容。/adiv onclickalert(this.innerHTML)元素内的文本内容。/div!doctype htmlhtmlheadmeta charsetUTF-8meta nameviewportcontentwidthdevice-width,initial-scale1/headbodyul idulli ida123/lilia111/lilib/lilic/li/ulbutton onclickconvertToChinaNum()执行/buttonscriptfunctiongetIndexInParent(element){varparentelement.parentNode;varchildrenparent.children;varindexArray.prototype.indexOf.call(children,element);returnindex;}functionconvertToChinaNum(){varcurrentElementdocument.querySelector(#ulli:last-of-type);varindexgetIndexInParent(currentElement);console.log(当前元素在父级元素中的索引位置是index)alert(index)}/script/body/html