PHP判断表单为空的函数,为什么不管用?

来源:百度知道 编辑:UC知道 时间:2024/07/04 01:50:01
function post()
{
if(document.form('searname').value=='')
{
alert("Please enter the keywords!");
document.form('searname').focus();
return false;
}
}

echo '<form method="post" action="search_admin_database.php" onsubmit="return post()">' . "\n\n";

晕,function post是PHP函数还是JS函数,这是从哪里学来的呢?

function post()
{
if(document.f1.searname.value=='')
{
alert("Please enter the keywords!");
document.form('searname').focus();
return false;
}
}

<form name="f1" id="f1" method="post" action="search_admin_database.php" onsubmit="return post()">