提交时出现错误!

Javaxhb 2004-10-02 02:43:20
<script language="VBScript">
function CheckForm()

if document.frmProfile.PName.value.length=0 then
call alert("please input your name.")
call document.frmProfile.PName.focus()
CheckForm=false
exit function
end if

CheckForm=true
end function
</script>

<form name="frmProfile" action="chkregister.asp" method="post" onsubmit="return CheckForm();" >
当提交时,document.frmProfile.PName.value.length有错误提示,没有找到对象,这是怎么回事?
...全文
91 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
Javaxhb 2004-10-02
  • 打赏
  • 举报
回复
这句如何改? englvr()和 Drowning(暑假過完了~~)都讲对了,现在还有一个错误就是:
if document.frmProfile.PName.value.indexOf("'")<>-1 then
alert("name can not include invalidation char!")
document.frmProfile.PName.focus
CheckForm=false
exit function
end if
这个怎么改?
if document.frmProfile.PName.value.indexOf("'")<>-1
改成
if instr(document.frmProfile.PName.value,"'")<>-1对吗?马上结贴.
serverme 2004-10-02
  • 打赏
  • 举报
回复
<script language="VBScript">
function CheckForm()

if document.frmProfile.PName.value.length="" then
call alert("please input your name.")
call document.frmProfile.PName.focus()
CheckForm=false
exit function
end if

CheckForm=true
end function
</script>
或者这样写
<script language="VBScript">
function CheckForm()

pname=document.frmProfile.PName.value
if pname.length=0 then
call alert("please input your name.")
call document.frmProfile.PName.focus()
CheckForm=false
exit function
end if

CheckForm=true
end function
</script>

iscandy 2004-10-02
  • 打赏
  • 举报
回复
采用 document.all.PName.value 就可以了。
Javaxhb 2004-10-02
  • 打赏
  • 举报
回复
用instr(document.frmProfile.PName.value,"'")可以吗,是怎么判断呢?
Javaxhb 2004-10-02
  • 打赏
  • 举报
回复
document.frmProfile.PName.value.indexOf("'")应该怎么写,快受不了人民邮电出版社了,什么了书!
topcool99 2004-10-02
  • 打赏
  • 举报
回复
同意。
Drowning 2004-10-02
  • 打赏
  • 举报
回复
看這一行
if document.frmProfile.PName.value.length=0 then
str.length是JavaScript的寫法
你可以改成
if len(if document.frmProfile.PName.value)=0 then
englvr 2004-10-02
  • 打赏
  • 举报
回复
call document.frmProfile.PName.focus()
->document.frmProfile.PName.focus
Javaxhb 2004-10-02
  • 打赏
  • 举报
回复
提示信息:
缺少对象: 'frmProfile.PName.value'

<form name="frmProfile" action="chkregister.asp" method="post" onsubmit="return CheckForm();" >
<tr>

<td valign="top" bgcolor="#000000"><TABLE border=0 align="right" cellPadding=3 cellSpacing=0 bordercolor="#000000">


<TR valign="middle" bgcolor="#FFFFFF">
<TD width="72" align=right bgcolor="#333333"><div align="right"><SPAN
class=SmallRed>*</SPAN> <B><SPAN
class=style2>Name</SPAN></B></div></TD>
<TD width="246" bgcolor="#000000"> <input maxlength=40
size=15 name="PName" id="PName"> <SPAN class=style2>(Stage
Name or Alias)</SPAN></TD>
</TR>

28,391

社区成员

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

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