本人ajax留言板的源程序 不错的应用js

2019-09-14 07:21:18王冬梅

        function requestdata()
        {
            fopen(obj);
            echo(obj,"正在提交数据,请稍等......");
            //alert(xmlhttp.readyState);
            if(xmlhttp.readyState==4)
            {
                //alert(xmlhttp.status);
                if(xmlhttp.status==200)
                {
                    echo(obj,xmlhttp.responseText);
                }
            }
        }
}
function checkform(obj,id)
{
    if(f("user")=="")
    {
        alert("请留下您的大名!!");
        setf("user");
        return false;
    }
    if(f("user").length>10 && f("user")<2 )
    {
        alert("姓名长度只能在2-10位之间!!");
    }
    if(f("title")=="")
    {
        alert("请填写留言标题!!");
        setf("title");
        return false;
    }
    if(f("title").length>50)
    {
        alert("对不起标题太长了!!");
        setf("title");
        return false;
    }
    if(f("content")=="")
    {
        alert("留言内容不能为空!!");
        setf("content");
        return false;
    }
    data="user="+escape(f("user"))+"&title="+escape(f("title"))+"&content="+escape(document.forms[0].content.value)+"&reply="+escape(f("reply"));