html5画图和本地存储

<!DOCTYPE HTML>
<html>
<body>

<canvas id="myCanvas" width="200" height="100" style="border:1px solid #c3c3c3;">
Your browser does not support the canvas element.
</canvas>
<script type="text/javascript">
function Pause(obj,s){
    this.GoOn = function(n,obj,s){
        if(n == 0){
            setTimeout(function(){GoOn(1,obj,s);},s);
        } else{
            obj.NextStep();
        }
    }
    this.GoOn(0,obj,s);
}

var c=document.getElementById("myCanvas");
var cxt=c.getContext("2d");
cxt.moveTo(20,20);

Pause(this,1000);
this.NextStep = function(){
    cxt.lineTo(180,80);
    cxt.stroke();

    Pause(this,1000);
    this.NextStep = function(){
        cxt.lineTo(20,80);
        cxt.stroke();

        Pause(this,1000);
        this.NextStep = function(){
            cxt.lineTo(20,20);
            cxt.stroke();
        }
    }
}


if (localStorage.lastname){
  localStorage.lastname=Number(localStorage.lastname) +1;
}else{
  localStorage.lastname=‘1‘;
 }
document.write(localStorage.lastname);

if (sessionStorage.pagecount){
  sessionStorage.pagecount=Number(sessionStorage.pagecount) +1;
}else{
  sessionStorage.pagecount=1;
 }
document.write("Visits "+sessionStorage.pagecount+" time(s) this session.");


</script>
</body>
</html>

html5画图和本地存储,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。