关于VBSCRIPT的客户端脚本的一个奇怪问题,请赐教!

sleepingtiger 2000-08-20 12:39:00
大虾,救命!
首先麻烦您将所附的代码复制到FRONTPAGE中预览一下我的问题页面,在此页面中我使用了VB脚本来做客户端验证。当选择单选按钮的“文章更改”时,一定要输入欲更改的文章编号,脚本中的一段程序就是用来防止用户未输入编号的。但是在浏览器里访问此页面,若选择“文章更改”而不输入编号直接按确定来提交表单,却出现“对象不支持此属性和方法‘document.form1.ratio1.value’”。可是“document.form1.articleno.value”又没有问题,这是什么原因?

附:页面代码
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>

<body topmargin="0" leftmargin="0" bgcolor="#FFCC99">
<script language="vbscript">
function checkpath(pathname)
if pathname.value="" or mid(trim(pathname.value),2,2)<> ":\" then
checkpath=false
else
checkpath=true
end if
end function
sub btnsubmit_onclick()
if document.form1.ratio1.value = 3 and document.form1.articleno.value = "" then
msgbox "选择更改文章一定要输入文章编号!"
else
if checkpath(document.form1.path) = false then
msgbox "请输入正确的路径名!"
else
form1.submit
end if
end if
end sub
</script>
<p align="center"> </p>
<p align="center"><b><font size="5" face="黑体">编辑妙文欣赏栏目的文章</font></b></p>
<hr>
<form method="POST" action="editgoodarticle.asp" name="form1">
<div align="center">
<center>
<table border="0" width="70%">
<tr>
<td width="96%"></td>
</tr>
</table>
<table border="0" width="70%">
<tr>
<td width="96%" colspan="2">
<div align="center">
<center>
<table border="0" width="90%">
<tr>
<td width="100%" valign="middle" align="center"><input type="radio" value="1" name="Ratio1" tabindex="1" checked>
文章输入<input type="radio" value="2" name="Ratio1" tabindex="2">文章组输入
<input type="radio" value="3" name="Ratio1" tabindex="3">文章更改</td>
</tr>
</table>
</center>
</div>
</td>
</tr>
<tr>
<td width="30%" align="right">输入文章路径:</td>
<td width="66%"><input type="text" name="path" size="36" tabindex="4"></td>
</tr>
<tr>
<td width="96%" colspan="2" align="center">提示:如果选择更改文章,请输入欲更改文章的编号</td>
</tr>
<tr>
<td width="30%" align="right">编      号:</td>
<td width="66%"><input type="text" name="articleno" size="20" tabindex="5"></td>
</tr>
</table>
</center>
</div>
<p align="center"><input type="button" value="确定" name="btnSubmit" tabindex="6"><input type="reset" value="重写" name="btnReset" tabindex="7"></p>
</form>

</body>

</html>

...全文
134 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
sleepingtiger 2000-08-22
  • 打赏
  • 举报
回复
非常感谢各位大虾的指点!
huntout 2000-08-21
  • 打赏
  • 举报
回复
if document.form1.ratio1(2).checked and document.form1.articleno.value = "" then
..
end if
subzero 2000-08-20
  • 打赏
  • 举报
回复
RADIO不能用value这个属性
华南虎哥 2000-08-20
  • 打赏
  • 举报
回复
我试了一下你的代码,但并没有那个地方调用你VBSCRIPT代码来检测的地方.
你可以在<form method="POST" action="editgoodarticle.asp" name="form1" onsubmit="Return checkpath">
另外,最好不要用VBSCRIPT,因为NETSCAPE用户的享受不到他的好处的,最好使用JAVASCRIPT比较通用.

28,390

社区成员

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

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