回 帖 发 新 帖 刷新版面

主题:求高手指点JAVAscrip转化成为VBsrip.

<SCRIPT LANGUAGE="JavaScript">
<!--//
function checkzhuce()
{   
    if (document.form.user.value.length<1)
    {
        alert("请填写用户名!");
        document.form.question.focus();
        return false;
    }
    if (document.form.password.value.length<1)
    {
        alert("请填写密码!");
        document.postart.key.focus();
        return false;
    }
}
//-->
这个是一个在ASP下面检查data这个access数据库中的user这个表的一段代码
用VB是如何实现
我写的代码如下:不知道是否正确,请高手指点
function checkzhuce()
    
    if  document.form.user.value.length<1
    
        alert("请填写用户名!");
        document.form.question.focus();
        return false;
    endif

    if  document.form.password.value.length<1 
    
        alert("请填写密码!");
        document.postart.key.focus();
        return false;
    endif

回复列表 (共2个回复)

沙发

vbscript 的if 语句是 
if .... then 
.... 
end if

另外每句后面不需要分号结尾,取返回值是用函数名=值的方式取得的

板凳

<script language=vbscript>
sub checkValue()
if len(document.all.user.value)<=1 then
alert("请你输入正确的用户名!")
window.event.returnValue=false
return
end if

if len(document.all.password.value)<=1 then
alert("请输入正确的密码!")
window.event.returnValue=false
return
end if 

end sub
</script>

我来回复

您尚未登录,请登录后再回复。点此登录或注册