zoukankan      html  css  js  c++  java
  • 自定义属性和充满屏幕

     <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
    </head>
    <body>
           <div>
               <img src="././../../../数据库/图片//png图片//bilibili.png" alt="">
           
            <input type="button" id="full" value="全屏">
            <input type="button" id="noFull" value="退出全屏">
            <input type="button" id="isFull" value="是否是全屏">
           </div>
            <script>
             window.onload=function(){
                 var div=document.querySelector("div");
                 document.querySelector("#full").onclick=function(){
                    if(div.webkitRequestFullScreen){
                        div.webkitRequestFullScreen();
                    }else if(div.msRequestFullScreen){
                        div.msRequestFullScreen();
                    }else if(div.mozRequestFullScreen){
                        div.mozRequestFullScreen();
                    }else{
                        div.requestFullScreen();
                    }
                 }
              
                //  document.querySelector("#noFull").onclick=function(){
                //      div.cancelFullScreen();
                //  }
                 
                //  document.querySelector("#isFull").onclick=function(){
                //      div.fullScreenElement();
                //  }
             } 
            </script>
    </body>
    </html> 
    <!--
    1.requestFullScreen();开启全屏显示  不同浏览器不同的前缀 firebox :moz IE:ms spera:o
    2.cancelFullScreen();关闭全屏显示
    3.fullScreenElement();是否是全屏状态
    
    
     <!-- 网络接口
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
    </head>
    <body>
        <script>
            //ononline当网络连接的时候触发
        window.addEventListener("online",function(){
            alert('有网');
        });    
        //onoffline 无网的时候触发
        window.addEventListener("offline",function(){
            alert('没网');
        }); 
        </script>
    </body>
    </html>
    
     
    
    <!--自定义属性 
        <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
    </head>
    <body>
    
        <p data-school-name="itcast">王星宇</p>
    
        <script> 
         window.onload=function(){
             var p=document.querySelector('p');
             var  value=p.dataset["schoolName"];
             console.log(value);
         }
        </script>
    </body>
    </html> 
    
    
        dete-开头 date-后至少有一个字符,多个单词使用-连接
  • 相关阅读:
    Java编程思想学习笔记(八)
    Java编程思想学习笔记(七)
    Java编程思想学习笔记(六)
    Java编程思想学习笔记(五)
    Java编程思想学习笔记(三)
    Java编程思想学习笔记(二)
    整合mybatis分页插件及通用接口测试出现问题
    jsp-简单的猜数小游戏
    java-web项目:用servlet监听器实现显示在线人数
    javaweb-servlet生成简单的验证码
  • 原文地址:https://www.cnblogs.com/wxy0715/p/12442082.html
Copyright © 2011-2022 走看看