1. 用js代碼 怎樣寫簡單彈球的游戲

你游戲的代碼不全,只有神仙或看過這個代碼的人知道

2. javascript小游戲及其代碼

?????????????

3. JavaScript製作貪吃蛇游戲代碼

蛇的身體:數組
食物:在規定范圍內生成的隨機數
蛇的身體累加:數組元版素個數增加
蛇碰牆權死:數組首個元素的x值或y值小於0或者大於地圖的寬度活高度
蛇咬自己死:數組首個元素的x值和y值和其他元素值重復
移動速度:在指定的時間內調用移動方法
開始:開始調用方法
暫停:暫停調用方法
積分:蛇沒吃一個食物,全局變數加1
自己做吧,很簡單,做完進步很大

4. JavaScript代碼設計一個骰子游戲

可以給圖片標簽加自定義屬性值比
<img xuhao="1~6" ....></img>
將玩家的輸入value與這個值(可能要轉整)相比較,一樣則對,不一樣則錯

5. 求一javascript小游戲代碼。【註:不要叫我去下載,你直接給我復制過來就可以了】。thank!!

代碼比較長 沒有注釋

腳本說明:

把如下代碼加入<body>區域中
<style>

.bigcell {

background-color:#aa9966;

border:4px solid #aa9966;

text-align:center;

}

.cell {

width:40px;

height:40px;

font-family:Verdana, Arial;

font-size:10pt;

font-weight:bold;

background-color:#996633;

color:#ffff33;

border-top:2px solid #aa9966;

border-left:2px solid #aa9966;

border-right:2px solid #663300;

border-bottom:2px solid #663300;

text-align:center;

}

.hole {

width:40px;

height:40px;

background-color:#aa9966;

text-align:center;

}

body,h1,h2,h3,.msg,capt1,capt2 {font-family:Verdana,Comic Sans MS,Arial;}

body {margin:0px;}

h1 {font-size:28pt; font-weight:bold; margin-bottom:0px;}

h2 {font-size:16pt; margin:0px; font-weight:bold;}

h3 {font-size:8pt; margin:0px; font-weight:bold;}

.msg {font-size:8pt; font-weight:bold;}

.tab {cursor:hand;}

.capt1 {font-size:10pt; font-weight:bold;}

.capt2 {font-size:9pt; font-weight:bold;}

.capt3 {font-size:14pt; font-weight:bold; color:yellow;}

.capt4 {font-size:10pt; font-weight:bold; color:yellow;}

.but {font-size:9pt; font-weight:bold; height:30px;background-color:#aaaa99;}

</style>
<BODY onLoad="loadBoard(4)">
<script>

var gsize, ghrow, ghcol, gtime, gmoves, gintervalid=-1, gshuffling;

function toggleHelp()

{

if (butHelp.value == "Hide Help")

{

help.style.display = "none";

butHelp.value = "Show Help";

}

else

{

help.style.display = "";

butHelp.value = "Hide Help";

}

}

//random number between low and hi

function r(low,hi)

{

return Math.floor((hi-low)*Math.random()+low);

}

//random number between 1 and hi

function r1(hi)

{

return Math.floor((hi-1)*Math.random()+1);

}

//random number between 0 and hi

function r0(hi)

{

return Math.floor((hi)*Math.random());

}

function startGame()

{

shuffle();

gtime = 0;

gmoves = 0;

tickTime();

gintervalid = setInterval("tickTime()",1000);

}

function stopGame()

{

if (gintervalid==-1) return;

clearInterval(gintervalid);

fldStatus.innerhtml = "";

gintervalid=-1;

}

function tickTime()

{

showStatus();

gtime++;

}

function checkWin()

{

var i, j, s;

if (gintervalid==-1) return; //game not started!

if (!isHole(gsize-1,gsize-1)) return;

for (i=0;i<gsize;i++)

for (j=0;j<gsize;j++)

{

if (!(i==gsize-1 && j==gsize-1)) //ignore last block (ideally a hole)

{

if (getValue(i,j)!=(i*gsize+j+1).toString()) return;

}

}

stopGame();

s = "<table cellpadding=4>";

s += "<tr><td align=center class=capt3>!! CONGRATS !!</td></tr>";

s += "<tr class=capt4><td align=center>You have done it in " + gtime + " secs ";

s += "with " + gmoves + " moves!</td></tr>";

s += "<tr><td align=center class=capt4>Your speed is " + Math.round(1000*gmoves/gtime)/1000 + " moves/sec</td></tr>";

s += "</table>";

fldStatus.innerHTML = s;

// shuffle();

}

function showStatus()

{

fldStatus.innerHTML = "Time: " + gtime + " secs Moves: " + gmoves

}

function showTable()

{

var i, j, s;

stopGame();

s = "<table border=3 cellpadding=0 cellspacing=0 bgcolor='#666655'><tr><td class=bigcell>";

s = s + "<table border=0 cellpadding=0 cellspacing=0>";

for (i=0; i<gsize; i++)

{

s = s + "<tr>";

for (j=0; j<gsize; j++)

{

s = s + "<td id=a_" + i + "_" + j + " onclick='move(this)' class=cell>" + (i*gsize+j+1) + "</td>";

}

s = s + "</tr>";

}

s = s + "</table>";

s = s + "</td></tr></table>";

return s;

}

function getCell(row, col)

{

return eval("a_" + row + "_" + col);

}

function setValue(row,col,val)

{

var v = getCell(row, col);

v.innerHTML = val;

v.className = "cell";

}

function getValue(row,col)

{

// alert(row + "," + col);

var v = getCell(row, col);

return v.innerHTML;

}

function setHole(row,col)

{

var v = getCell(row, col);

v.innerHTML = "";

v.className = "hole";

ghrow = row;

ghcol = col;

}

function getRow(obj)

{

var a = obj.id.split("_");

return a[1];

}

function getCol(obj)

{

var a = obj.id.split("_");

return a[2];

}

function isHole(row, col)

{

return (row==ghrow && col==ghcol) ? true : false;

}

function getHoleInRow(row)

{

var i;

return (row==ghrow) ? ghcol : -1;

}

function getHoleInCol(col)

{

var i;

return (col==ghcol) ? ghrow : -1;

}

function shiftHoleRow(src,dest,row)

{

var i;

//conversion to integer needed in some cases!

src = parseInt(src);

dest = parseInt(dest);

if (src < dest)

{

for (i=src;i<dest;i++)

{

setValue(row,i,getValue(row,i+1));

setHole(row,i+1);

}

}

if (dest < src)

{

for (i=src;i>dest;i--)

{

setValue(row,i,getValue(row,i-1));

setHole(row,i-1);

}

}

}

function shiftHoleCol(src,dest,col)

{

var i;

//conversion to integer needed in some cases!

src = parseInt(src);

dest = parseInt(dest);

if (src < dest)

{//alert("src=" + src +" dest=" + dest + " col=" + col);

for (i=src;i<dest;i++)

{//alert(parseInt(i)+1);

setValue(i,col,getValue(i+1,col));

setHole(i+1,col);

}

}

if (dest < src)

{

for (i=src;i>dest;i--)

{

setValue(i,col,getValue(i-1,col));

setHole(i-1,col);

}

}

}

function move(obj)

{

var r, c, hr, hc;

if (gintervalid==-1 && !gshuffling)

{

alert('請點擊"開始游戲"按鈕')

return;

}

r = getRow(obj);

c = getCol(obj);

if (isHole(r,c)) return;

hc = getHoleInRow(r);

if (hc != -1)

{

shiftHoleRow(hc,c,r);

gmoves++;

checkWin();

return;

}

hr = getHoleInCol(c);

if (hr != -1)

{

shiftHoleCol(hr,r,c);

gmoves++;

checkWin();

return;

}

}

function shuffle()

{

var t,i,j,s,frac;

gshuffling = true;

frac = 100.0/(gsize*(gsize+10));

s = "% ";

for (i=0;i<gsize;i++)

{

s += "|";

for (j=0;j<gsize+10;j++)

{

window.status = "Loading " + Math.round((i*(gsize+10) + j)*frac) + s

if (j%2==0)

{

t = r0(gsize);

while (t == ghrow) t = r0(gsize); //skip holes

getCell(t,ghcol).click();

}

else

{

t = r0(gsize);

while (t == ghcol) t = r0(gsize); //skip holes

getCell(ghrow,t).click();

}

}

}

window.status = "";

gshuffling = false;

}

function loadBoard(size)

{

gsize = size;

board.innerHTML = showTable(gsize);

setHole(gsize-1,gsize-1);

//shuffle();

}

</script>
<div id=test></div>

<table cellpadding=4>

<tr><td align=center>

<b>請選擇難度: </B>

<select id=level onchange="loadBoard(parseInt(level.value))">

<option value='3'>3</option>

<option value='4' selected>4</option>

<script>

for (var i=5;i<=10;i++)

{

document.write("<option value='" + i + "'>" + i + "</option>");

}

</script>

</select>

</td></tr>

<tr><td align=center>

<input type=button class=but value="開始游戲" onclick="startGame();">

<tr><td align=center id=fldStatus class=capt2>

</td></tr>

</table>

<div id=board></div>

6. 求一個用JS寫的21點游戲代碼

填寫你的回答

7. 游戲注冊頁面js代碼怎麼寫

//郵箱,用戶名,密碼正則已經驗證完成的情況下
varbtn=$("#targetBtn");
btn.on("click",function(){
varusername=$("#username").val(),
password=$("#password").val(),
email=$("#email").val;
if(username==""){
alert("請填寫用戶名");
returnfalse;
}
//...此處省略if判斷
$.ajax({
url:"...",
type:POST,
data:{"..."},//這里寫提交的數據
success:function(data){
if(data.message=="success"){
alert("注冊成功")
}
}
})

8. 自己用js寫了個網頁小游戲,想發給女友玩一下,女友不懂代碼,只會電腦的基本操作,我怎麼發給她玩呢

你自己運行過了嗎?你怎麼運行,她就怎麼運行。
我打聽個事:你女友的電腦是內不是與眾不同,不容能用你運行html文件的方式運行?
html文件直接用瀏覽器打開就行了,html和嵌在html中的js代碼都是由瀏覽器執行的。

9. 100求一個javascript的傲遊戲腳本

javascript:if(_m_click)clearInterval(_m_click);_m_click=setInterval(function(){SC.Work.op({m:'storeEnergy'});},1000*60*5);

5 分鍾自動點一次.

---------------------

http://www.ialvin.cn/mplugin.rar 下載

10. 初學者使用JavaScript代碼做簡單猜數字游戲,不要彈出窗口的.請問怎樣做

<html>
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
</head>
<body>
<inputtype="button"id="play"name="play"value="PlayGame"onclick="play()"/>
<inputtype="text"id="answer"/><inputtype="button"value="Submit"onclick="doSubmit()"/>
<spanid="sp"></span>
<scriptlanguage="javascript">
varnum;
vari=0;
functionplay(){
i=0;
num=Math.round(Math.random()*10);
varcs="猜1到10之間的數字,您只有十次才的機會哦,加油哦、、、、、";
document.getElementById('sp').innerHTML=cs;
}
functiondoSubmit(){
varanswer=document.getElementById('answer').value;
i++;
if(answer>num){
alert("這是第"+i+"次輸入,你輸入的數大了!<br>");

}elseif(answer<num){
alert("這是第"+i+"次輸入,你輸入的數小了!<br>");
}elseif(answer==num){
switch(i){
case1:
alert("你真神了!!!");
break
case2:
alert("哎喲!不錯哦!!!");
break
case3:
alert("很好很好!!!");
break
case4:
alert("不錯,不錯!!!");
break
case5:
alert("加油加油!!!");
break
case6:
alert("要繼續努力昴!!!");
break
case7:
alert("還要再加油啊!!!");
break
case8:
alert("勉強猜對了!!!");
break
case9:
alert("算你過了!!!");
break
case10:
alert("運氣不錯哦!!!");
break;
}
}
if(i>10)
alert("笨蛋,十次都沒有猜對!!!");
}
</script>
</body>
</html>

試一下。