javascriptが実現したマルチブラウザサポートの食いしん坊webgame


書いたのはとても疲れました ,3時間書きましたみんなは遊んでインターフェースを見てもいいです。charset=gb 2312'<>www.jb 51.net私達は蛇を食べることに貪欲です。body{magin-left:0 px;margin-top:0 px;骢global{magin:atot}position:relative;width:800 px;height:500 pxborder:thick double葎background-色:菗global菗p{background-色:玩99999;position:absolute;height:500 pxwidth:500 px;left:0 px;top:0 px;border-right-width:thick;border-right-style:double;border-right-カラー:33859;FF0000;global菗p38075;k{background-カラー:钾0000 FF;position:absolute;height:25 pxwidth:25 px;left:0 px;top:0 px;{}〹global萼p.xin{position:absolute}height:25 pxwidth:25 px;></style><script laguage="javascript"type="text/javascript"//新生元素位置var bucunzi=trueを取得する。新しい要素が移動var xinkxであるかを記録します。var xinky//ページロード後k元素ポジショニングfunction lo(){var object=document.getElement ById("k")object.style.left="250 px"object p.style.top="250 px"/K元素の最終パターンコードk_zz=object.current Style?document.get Element ById(「k」).currentStyle:document.defaultView.getComputatidStyle;記録位置の配列var k_x=new Aray()var k_y=new Aray()//蛇の長さを記録するvar k_number=0/方向キー関数document.onkeydown=pmove;var fx=0//前回のボタンを取得して直接function pmove(){if(bucunzai){xin();bucunzai=false;object=document.getElemenntById(「k」)kcode=window.event?window.event:argments[0];if(kcode.keyCode==39&&fx!=39&amp;fx!=37){fx=kcode.keyCode;try{clear Interval(kbottom)}catch(e){}try{clear Interval(kright)}。catch(e){}try{clear Interval(ktop)}catch(e){}try{clear Interval(kleft)}。catch(e){}kleft=set Interval(function){if(parseInt(object.style.left)>=475){alert(超過しました);clear Interval(kleft);else{if(k_u)x.length>=400){k_x.shift()k_y.shift();;k_x[k_]x.length==k_zz.left;k_y[k_]y.length=k_zz.top;object p.style.left=(parseInt(object p.style.left)+25)+「px」if(k_zz.left==xinkx&&k_zz.top==xinky){k_number++;xin();k_kmove();}100)}if(kcode.keyCode==37& amp;&fx!=39&amp;fx!=37){fx=kcode.keyCode;try{clear Interval(kbottom)}catch(e){}try{clear Interval(kright)}。catch(e){}try{clear Interval(ktop)}catch(e){}try{clear Interval(kleft)}。catch(e){}kright=set Interval(function){if(parseInt(object.style.left)<=0){alert(超過しました);clear Interval(kright);else{if(k_u)x.length>=400){k_x.shift()k_y.shift();;k_x[k_]x.length==k_zz.left;k_y[k_]y.length=k_zz.top;object p.style.left=(parseInt(object p.style.left)-25)+「px」if(k_zz.left==xinkx&&k_zz.top==xinky){k_number++;xin();k_kmove();}100)}if(kcode.keyCode==40&&fx!=40&amp;fx!=38){fx=kcode.keyCode;try{clear Interval(kbottom)}catch(e){}try{clear Interval(kright)}。catch(e){}try{clear Interval(ktop)}catch(e){}try{clear Interval(kleft)}。catch(e){}kbottom=set Interval(function){if(parseInt(object.style.top)>=475){alert(超過しました);clear Interval(kbottom);else{if(k_u)x.length>=400){k_x.shift()k_y.shift();;k_x[k_]x.length==k_zz.left;k_y[k_]y.length=k_zz.top;object p.style.top=(parseInt(object.style.top)+25)+「px」if(k_zz.left==xinkx&&k_zz.top==xinky){k_number++;xin();k_kmove();}100)}if(kcode.keyCode==38&&fx!=40&amp;fx!=38){fx=kcode.keyCode;try{clear Interval(kbottom)}catch(e){}try{clear Interval(kright)}。catch(e){}try{clear Interval(ktop)}catch(e){}try{clear Interval(kleft)}。catch(e){}ktop=set Interval(function){if(parseInt(object.style.top)<=0){alert(超過しました);clear Interval(ktop);else{if(k_u)x.length>=400){k_x.shift()k_y.shift();;k_x[k_]x.length==k_zz.left;k_y[k_]y.length=k_zz.top;object p.style.top=(parseInt(object.style.top)-25)+「px」if(k_zz.left==xinkx&&k_zz.top==xinky){k_number++;xin();k_kmove();}100)}//新しい要素コードfunction xin(){var xinkleft=parseInt(Math.random()*25+px];var xinktop=parseInt(Math.random()*20)*25+「px」var xinkColor 1=parseInt(Math. randdom(*)14).toString(16)var xinkcolor 2=parseInt(Math. randdom(*)14).toStString(16)var xinkColor 3=parseInt(Math. rantdom(*14)=String.String 4=String Mathbubububububububububububububububububububuntntntnt(14)=String 4=String 4=String 4=String 4=String(16)String.String.String(Mathtototototototototototototototototototo( Math.random()*14).toString(16)var xink color 6=parseInt(Math.random(*)14).toString(16)var xink=document.reat Element(「div」)xink.id=「k」+k_number xin k.class Name=“xin”xink.style.left=xinkleft.styyle.top=xinktop=xinktop.styyle.backgroundColor=“\\\\\\\\\\\\\\\?;;Color1+xinkColor 1+xinkColor 1+xinkcolor 2+xinkcolor 2+xinkcolor 2+xinkcolor 2+xin k=xinkleft xinky=xinktop//新しい要素はモバイル関数function k_に従います。kmove(){if}number==0){}else{for(var i=0;i<k_number;i+){var move=document.getElemenntById("k"+i)move.style.top=k_y[k_]y.length-(i+1)]move.style.left=k_x[k_]x.length-(i+1)}</script><div id="global"<div id="p"style="top:0 px;left:0 px;""div id="k"/""div"</div>[Ctrl+A全注:<a href="https://www.jb51.net/article/23421.htm" title="查看具体详情" rel="noreferrer noopener nofollow">引入外部Js需再刷新一下页面才能执行</a>]