• 吴裕雄--天生自然PHP-MySQL-JavaScript学习笔记:HTML5画布


    <!DOCTYPE html>
    <html> <!-- geolocation.html -->
      <head>
        <title>Geolocation Example</title>
      </head>
      <body>
        <script>
          if (typeof navigator.geolocation == 'undefined')
             alert("Geolocation not supported.")
          else
            navigator.geolocation.getCurrentPosition(granted, denied)
    
          function granted(position)
          {
            var lat = position.coords.latitude
            var lon = position.coords.longitude
            
            alert("Permission Granted. You are at location:
    
    "
              + lat + ", " + lon +
              "
    
    Click 'OK' to load Google Maps with your location")
    
            window.location.replace("https://www.google.com/maps/@"
              + lat + "," + lon + ",14z")
          }
    
          function denied(error)
          {
            var message
    
            switch(error.code)
            {
              case 1: message = 'Permission Denied'; break;
              case 2: message = 'Position Unavailable'; break;
              case 3: message = 'Operation Timed Out'; break;
              case 4: message = 'Unknown Error'; break;
            }
    
            alert("Geolocation Error: " + message)
          }
        </script>
      </body>
    </html>
    <!DOCTYPE html>
    <html>
      <head>
        <title>HTML5 Video</title>
      </head>
      <body>
        <video width='560' height='320' controls>
          <source src='movie.mp4'  type='video/mp4'>
          <source src='movie.webm' type='video/webm'>
          <source src='movie.ogv'  type='video/ogg'>
        </video>
      </body>
    </html>
    function O(i) { return typeof i == 'object' ? i : document.getElementById(i) }
    function S(i) { return O(i).style                                            }
    function C(i) { return document.getElementsByClassName(i)                    }
    <!DOCTYPE html>
    <html>
      <head>
        <title>The HTML5 Canvas</title>
        <script src='OSC.js'></script>
      </head>
      <body>
        <canvas id='mycanvas' width='320' height='240'>
          This is a canvas element given the ID <i>mycanvas</i>
          This text is only visible in non-HTML5 browsers
        </canvas>
        <script>
          canvas            = O('mycanvas')
          context           = canvas.getContext('2d')
          context.fillStyle = 'red'
          S(canvas).border  = '1px solid black'
    
          context.beginPath()
          context.moveTo(160, 120)
          context.arc(160, 120, 70, 0, Math.PI * 2, false)
          context.closePath()
          context.fill()
        </script>
      </body>
    </html>
  • 相关阅读:
    修复mac os中的home键和end键
    利用numpy实现list降维
    string与StringBuilder的区别
    mysql 版本,mysqlconnectorjava, application.xml 的 driverclassname 的依赖关系
    linux下创建新用户新数据库并远程访问
    谷歌的JS编码规范链接
    sed命令之多行拷贝
    box2dWeb引擎案例
    SQL Server数据库镜像笔记
    团队项目系统设计
  • 原文地址:https://www.cnblogs.com/tszr/p/12383005.html
Copyright © 2020-2023  润新知