• 给网站增加一个夜间模式

    首先,我们需要在主题模板中打开“footer.php”文件,在“”前添加如下代码:<scripttype="text/javascript">functionswitchNightMode(){varnight=document.cookie.replace(/(?:(?:^|.*;\s*)night\s*\=\s*([^;]*).*$)|^.*$/,"$1&quo...

    建站教程2025-10-22
  • js给div追加内容,不覆盖之前内容

    DIV<divid="append">ss</div><script>vardivA=document.getElementById("append");divA.innerHTML=divA.innerText+'追加的内容s';//divA.innerHTML+='追加的内容s&...

    建站教程2025-10-22
  • 给网站增加视频背景特效

    html代码<videoautoplayloopmuted><sourcesrc="视频地址"type="video/mp4"/></video>CSS代码<style>video{position:fixed;...

    建站教程2025-10-22
  • JS实现下载图片,JS实现把图片转成Base64

    通过JavaScript脚本可以把远程的图片转换为Base64,通过JavaScript脚本可以把远程的图片下载到本地。直接上代码://将远程图片转化为base64functiongetBase64(img){functiongetBase64Image(img,width,height){//width、h...

    建站教程2025-10-22
  • JS获取文件后缀

    代码://获取文件后缀functiongetType(file){varfilename=file;varindex1=filename.lastInd...

    建站教程2025-10-22
  • js获取文件文件名去掉后缀名

    代码很简单直接贴://js获取文件文件名去掉后缀名varfilename=file.name.substring(0,file.name.lastIndexOf("."));...

    建站教程2025-10-22