日期:2014-05-17  浏览次数:20955 次

html5初学者
<!DOCTYPE HTML> 
<html> 
<body> 
 
<canvas id="arcCanvas" width="200" height="100" style="border:1px solid #c3c3c3;"> 
    Your browser does not support the canvas element.  
</canvas> 
 
<canvas id="lineCanvas" width="200" height="100" style="border:1px solid #c3c3c3;"> 
    Your browser does not support the canvas element.  
</canvas> 
 
<canvas id="grdCanvas" width="200" height="100" style="border:1px solid #c3c3c3;"> 
    Your browser does not support the canvas element.  
</canvas> 
 
<canvas id="imageCanvas" width="80" height="175" style="border:1px solid #c3c3c3;"> 
    Your browser does not support the canvas element.  
</canvas> 
 
<script type="text/javascript"> 
    var c=document.getElementById("arcCanvas");  
    var ccxt=c.getContext("2d");  
    cxt.fillStyle="#FF0000";  
    cxt.beginPath();  
    cxt.arc(70,18,15,0,Math.PI*2,true);  
    cxt.closePath();  
    cxt.fill();  
</script> 
 
<script type="text/javascript"> 
    var c=document.getElementById("lineCanvas");  
    var ccxt=c.getContext("2d");  
    cxt.moveTo(10,10);  
    cxt.lineTo(150,50);  
    cxt.lineTo(10,50);  
    cxt.stroke();  
</script> 
 
<script type="text/javascript"> 
    var c=document.getElementById("grdCanvas");  
    var ccxt=c.getContext("2d");  
    var grd=cxt.createLinearGradient(0,0,175,50);  
    grd.addColorStop(0,"#FF0000");  
    grd.addColorStop(1,"#00FF00");  
    cxt.fillStyle=grd;  
    cxt.fillRect(0,0,175,50);  
</script> 
 
<script type="text/javascript"> 
    var c=document.getElementById("imageCanvas");  
    var ccxt=c.getContext("2d");  
    var img=new Image()  
    img.src="flower.jpg" 
    cxt.drawImage(img,0,0);  
</script> 
 
<br> 
<br> 
<br>localStorage   
<br> 
<script type="text/javascript"> 
    localStorage.lastname="Smith";  
    document.write(localStorage.lastname);  
</script> 
 
<br> 
<br> 
<script type="text/javascript"> 
    if (localStorage.pagecount)  
    {  
      localStorage.pagecount=Number(localStorage.pagecount) +1;  
    }  
    else  
    {  
      localStorage.pagecount=1;  
    }  
    document.write("Visits "+ localStorage.pagecount + " time(s).");