那位有时间给完善一下,现在是电脑出的是英文,把电脑出的换成图
[code=JScript] [ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function playGame(choice) {
with (document.game) {
comp = Math.round((Math.random() * 2) + 1);
var choicename;
if (comp == 1) choicename = <img src="photo/rock.gif" width=29 height=23 border=0>;
if (comp == 2) choicename = <img src="photo/paper.gif" width=29 height=23 border=0>;
if (comp == 3) choicename = <img src="photo/scissors.gif" width=29 height=23 border=0>;
//msg.value = 'The computer chose ' + choicename + '; ';
switch(choice) { // calculates score
case 1 : // rock
if (comp == 1) { draw.value++; msg.value += 'It is a draw.'; break; }
if (comp == 2) { loss.value++; msg.value += 'You lost!'; break; }
if (comp == 3) { win.value++; msg.value += 'You won!'; break; }
case 2 : // paper
if (comp == 1) { win.value++; msg.value += 'You won!'; break; }
if (comp == 2) { draw.value++; msg.value += 'It is a draw.'; break; }
if (comp == 3) { loss.value++; msg.value += 'You lost!'; break; }
case 3 : // scissors
if (comp == 1) { loss.value++; msg.value += 'You lost!'; break; }
if (comp == 2) { win.value++; msg.value += 'You won!'; break; }
if (comp == 3) { draw.value++; msg.value += 'It is a draw.'; break; }
}
msg.value += ' Go again!';
}
}
// End -->
</script>
<body>
<form name=game>
<table border=1 cellpadding=5>
<tr>
<td align=center>请选择你用:</td>
<td align=center><a href="javascript:void(0);" onClick="playGame(1);"><img src="photo/rock.gif" width=29 height=23 border=0></a></td>
<td align=center><a href="javascript:void(0);" onClick="playGame(2);"><img src="photo/paper.gif" width=29 height=23 border=0></a></td>
<td align=center><a href="javascript:void(0);" onClick="playGame(3);"><img src="photo/scissors.gif" width=29 height=23 border=0></a></td>
</tr>
<tr>
<td colspan=4 align=center ><input type=text name=msg size=45></td>
</tr>
<tr>
<td colspan=4 align=center>
<input type=text name=win readonly value="0" size="2"> 赢
<input type=text name=loss readonly value="0" size="2"> 输
<input type=text name=draw readonly value="0" size="2"> 平
</td>
</tr>
</table>
</form>
</body>
</html>
/code]
[code=JScript] [ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function playGame(choice) {
with (document.game) {
comp = Math.round((Math.random() * 2) + 1);
var choicename;
if (comp == 1) choicename = <img src="photo/rock.gif" width=29 height=23 border=0>;
if (comp == 2) choicename = <img src="photo/paper.gif" width=29 height=23 border=0>;
if (comp == 3) choicename = <img src="photo/scissors.gif" width=29 height=23 border=0>;
//msg.value = 'The computer chose ' + choicename + '; ';
switch(choice) { // calculates score
case 1 : // rock
if (comp == 1) { draw.value++; msg.value += 'It is a draw.'; break; }
if (comp == 2) { loss.value++; msg.value += 'You lost!'; break; }
if (comp == 3) { win.value++; msg.value += 'You won!'; break; }
case 2 : // paper
if (comp == 1) { win.value++; msg.value += 'You won!'; break; }
if (comp == 2) { draw.value++; msg.value += 'It is a draw.'; break; }
if (comp == 3) { loss.value++; msg.value += 'You lost!'; break; }
case 3 : // scissors
if (comp == 1) { loss.value++; msg.value += 'You lost!'; break; }
if (comp == 2) { win.value++; msg.value += 'You won!'; break; }
if (comp == 3) { draw.value++; msg.value += 'It is a draw.'; break; }
}
msg.value += ' Go again!';
}
}
// End -->
</script>
<body>
<form name=game>
<table border=1 cellpadding=5>
<tr>
<td align=center>请选择你用:</td>
<td align=center><a href="javascript:void(0);" onClick="playGame(1);"><img src="photo/rock.gif" width=29 height=23 border=0></a></td>
<td align=center><a href="javascript:void(0);" onClick="playGame(2);"><img src="photo/paper.gif" width=29 height=23 border=0></a></td>
<td align=center><a href="javascript:void(0);" onClick="playGame(3);"><img src="photo/scissors.gif" width=29 height=23 border=0></a></td>
</tr>
<tr>
<td colspan=4 align=center ><input type=text name=msg size=45></td>
</tr>
<tr>
<td colspan=4 align=center>
<input type=text name=win readonly value="0" size="2"> 赢
<input type=text name=loss readonly value="0" size="2"> 输
<input type=text name=draw readonly value="0" size="2"> 平
</td>
</tr>
</table>
</form>
</body>
</html>
/code]
解决方案 »
- 为什么向文本输入不了内容?
- [ 分享 ] html5 canvas写的 连连看
- 是不是只要给网页中加JAVASCRIPT.打开网页的时候在浏缆器上就会出现那么一条信息.IE已限制此网页可以访问计算机的脚本或Activex控件?
- 高手门帮我改下!!!
- ff下如何读取padding
- onmousemove恩提
- 如何获取标签元素里的文本内容字符数
- 公司的人都不会,又来麻烦各位高手拉,200分,另开贴补足
- 高手指点关于定时器
- Extjs4.2 MVC模式开发动态添加TabPanel的时候子页对应的controller无法触发
- 求js树形源码,最好是“资源管理器”的那种(有图片最好)
- 设置span的宽度为其父容器(div)宽度-20该怎么做
那位有时间给完善一下,现在是电脑出的是英文,把电脑出的换成图
版权所有,翻版不究!