• 吴裕雄--天生自然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>
  • 相关阅读:
    Android Studio 常用快捷键以及设置
    GitHub windows客户端拉代码和提交代码
    Android Studio + gradle多渠道打包
    Android sdk 镜像服务器资源
    Rikka with Graph(联通图取边,暴力)
    Rikka with Chess(规律)
    Largest Submatrix(动态规划)
    City Game(动态规划)
    Largest Rectangle in a Histogram(最大矩形面积,动态规划思想)
    How many ways(记忆化搜索)
  • 原文地址:https://www.cnblogs.com/tszr/p/12383005.html
Copyright © 2020-2023  润新知