1 <!DOCTYPE html> 2 <html lang=‘zh-cn‘> 3 <head> 4 <title>Insert you title</title> 5 <meta name=‘description‘ content=‘this is my page‘> 6 <meta name=‘keywords‘ content=‘keyword1,keyword2,keyword3‘> 7 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 8 <link rel=‘stylesheet‘ type=‘text/css‘ href=‘./css/index.css‘ /> 9 <script type=‘text/javascript‘ src=‘./js/jquery-1.12.1.min.js‘></script> 10 <style type=‘text/css‘> 11 html,body,canvas,div,select,option { 12 margin: 0; padding: 0; 13 } 14 15 html { 16 height: 100%; 17 } 18 19 body { 20 background: #666; 21 } 22 23 #can { 24 display: block; margin: 25px auto; background: #FFF; border-radius: 2px; 25 } 26 </style> 27 <script type=‘text/javascript‘> 28 $( document ).ready( function(){ 29 var can = $( ‘#can‘ ).get( 0 ); 30 var oCan = can.getContext( ‘2d‘ ); 31 oCan.beginPath(); 32 oCan.fillStyle = ‘#F00‘; 33 oCan.fillRect( 100 , 100 , 100 , 100 ); 34 oCan.save(); 35 oCan.globalAlpha = .5; 36 oCan.fillStyle = ‘#0F0‘; 37 oCan.fillRect( 150 , 150 , 100 , 100 ); 38 oCan.restore(); 39 oCan.closePath(); 40 } ) 41 </script> 42 </head> 43 <body> 44 <canvas id=‘can‘ width=‘500‘ height=‘450‘>检测到您的浏览器版本过低请升级您的浏览器以获取更好的用户体验...</canvas> 45 </body> 46 </html>
时间: 2024-10-21 14:07:17