Microsoft VBScript 编译器错误 (0x800A0409)困扰我很久了

ristin 2009-12-29 06:43:34
未结束的字符串常量
/index.asp, line 20, column 24
response.write "鎴戜滑骞虫墜浜?
代码如下:
<%
Function ComputerChoose()
Dim RandomNum
Dim choice
Randomize
RandomNum=int(rnd*3)+1
if RandomNum=1 then
choice="R"
elseif RandomNum=2 then
choice="S"
else
choice="P"
end if
ComputerChoose=choice
End Function
Sub DetermineWinner(playerChoice,computerChoice)
if playerChoice="R" then
if computerChoice="R" then
response.write "<font color=red>石头</font>-----<font color=blue>石头</font><br>"
response.write "我们平手了"
elseif computerChoice="S" then
response.write "<font color=red>石头</font>-----<font color=blue>剪子</font><br>"
response.write "恭喜你,你赢了"
elseif computerChoice="P" then
response.write "<font color=red>石头</font>-----<font color=blue>布</font><br>"
response.write "恭喜你,你赢了"
end if
elseif playerChoice="S" then
if computerChoice="R" then
response.write "<font color=red>剪子</font>-----<font color=blue>石头</font><br>"
response.write "恭喜你,你赢了"
elseif computerChoice="S" then
response.write "<font color=red>剪子</font>-----<font color=blue>剪子</font><br>"
response.write "我们平手了"
elseif computerChoice="P" then
response.write "<font color=red>剪子</font>-----<font color=blue>布</font><br>"
response.write "恭喜你,你赢了"
end if
elseif playerChoice="P" then
if computerChoice="R" then
response.write "<font color=red>布</font>-----<font color=blue>石头</font><br>"
response.write "恭喜你,你赢了"
elseif computerChoice="S" then
response.write "<font color=red>布</font>-----<font color=blue>剪子</font><br>"
response.write "这次我赢了"
elseif computerChoice="P" then
response.write "<font color=red>布</font>-----<font color=blue>布</font><br>"
response.write "我们平手了"
end if
end if
End sub
%>
<html>
<title>石头、剪子、布小游戏</title>
<body>
<center>
玩家:<font color=white>------</font>电脑:<br>
<%
dim player
dim computer
player=request("choice")
if player="P" or player="R" or player="S" then
computer=ComputerChoose()
call DetermineWinner(player,computer)
end if
%>
<hr>
请选择你的武器:
<form action=index.asp method=post>
<input type=radio name=choice value="R">石头<br>
<input type=radio name=choice value="S">剪子<br>
<input type=radio name=choice value="P">布  <br>
<input type=submit value=开战>
</form>
</center>
</body>
</html>
...全文
378 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
ristin 2009-12-30
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 anlige 的回复:]
编码。。。保证文件的编码,页面的编码,程序的编码一致
[/Quote]
你说得很对啊!
ristin 2009-12-30
  • 打赏
  • 举报
回复
我找到问题出在哪了,原来在新建动态页面时,我用DW编写时需根据所有脚本语言的不同(VB和JS)来选择不同的页面选项,我选项搞错了。
解决方法:打开记事本,把代码复制进去保存为.ASP就OK了!~~~~~~~~~

谢谢各位的帮忙!!!特别是小白哈!
ender129 2009-12-30
  • 打赏
  • 举报
回复
我有你一样的情况 我经常乱码
我这里有一个东西 你加在最上面
<%@ CODEPAGE=65001%>
<%Response.CodePage=65001%>
<%Response.Charset="UTF-8"%>
或许可以帮你
ristin 2009-12-29
  • 打赏
  • 举报
回复
既然你运行了没错,那估计是运行环境的问题了。可我运行一个其他简单的ASP程序又没有问题,运行这个就出错。和我使用的是局域网上网有关系吗?
ristin 2009-12-29
  • 打赏
  • 举报
回复
[Quote=引用 14 楼 yan11cn 的回复:]
引用 12 楼 ristin 的回复:
你是用IIS运行的吗?IIS需要改些什么设置!


我用iis也试过了 一样好使。。。
要是单单是浏览器这边编码不对也不会报错 显示乱码而已

[/Quote]
难道我人品有问题,呵呵!
ristin 2009-12-29
  • 打赏
  • 举报
回复
[Quote=引用 13 楼 anlige 的回复:]
编码。。。保证文件的编码,页面的编码,程序的编码一致
[/Quote]
能通俗点吗,好深奥。
yan11cn 2009-12-29
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 ristin 的回复:]
你是用IIS运行的吗?IIS需要改些什么设置!
[/Quote]

我用iis也试过了 一样好使。。。
要是单单是浏览器这边编码不对也不会报错 显示乱码而已
Anlige 2009-12-29
  • 打赏
  • 举报
回复
编码。。。保证文件的编码,页面的编码,程序的编码一致
ristin 2009-12-29
  • 打赏
  • 举报
回复
你是用IIS运行的吗?IIS需要改些什么设置!
ristin 2009-12-29
  • 打赏
  • 举报
回复
是在一行。
yan11cn 2009-12-29
  • 打赏
  • 举报
回复
你检查下
response.write " <font color=red>石头 </font>----- <font color=blue>石头 </font> <br>"
这样的语句是否都一行显示 是不是有不小心分成2行的 那样也会导致

Microsoft VBScript 编译器错误 '800a0409'

未结束的字符串常量
ristin 2009-12-29
  • 打赏
  • 举报
回复
可以呀
比如:
<%
Response.Write "hello world 我的第一个ASP程序!"
%>
能运行呀!
yan11cn 2009-12-29
  • 打赏
  • 举报
回复
那就奇怪了 AWS.exe其实也是基于netbox的 对asp支持很到位。。。
那会是什么问题呢。。。

你随便写个只输出一两句中文的asp文件试试 能不能正常显示
ristin 2009-12-29
  • 打赏
  • 举报
回复
我的代码就是上面复制的呀,没有
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
ristin 2009-12-29
  • 打赏
  • 举报
回复
我开始用的是AWS.exe,又用了netbox,最后又装了IIS,在IIS中我把端口号默认的设为80就报以上的错误,改成81后就变成找不到服务器了。
yan11cn 2009-12-29
  • 打赏
  • 举报
回复
你是不是在代码中使用了utf-8的编码?
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
yan11cn 2009-12-29
  • 打赏
  • 举报
回复
我在iis下和netbox下直接复制运行的
ie浏览器中编码方式gb2312显示结果
ristin 2009-12-29
  • 打赏
  • 举报
回复
你是用什么运行环境呀?
yan11cn 2009-12-29
  • 打赏
  • 举报
回复
更正:我->我觉得
yan11cn 2009-12-29
  • 打赏
  • 举报
回复
这个我不是代码的问题,可能是你的运行环境造成的,你这代码我考过来 可以直接出结果

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧