求asp判断代码

来源:百度知道 编辑:UC知道 时间:2024/06/18 11:42:12
<script language="javascript">
<!--
function check(){
if (document.form1.textfield.value==""){
alert("搜索内容不可以为空!");
return false;
}
if(document.form1.textfield.value=="???"){
alert("搜索内容不可以为空!");
return false;
}
return true;
}
-->
</script>

问号部分怎么写?我想同时判断是否为1个或多个空格!!

???部分不就是上面的吗?代表textfield这个表单不为空

???可以是某一个值也可以直接是""

还有这不是ASP代码

String.prototype.Trim = function(){return this.replace(/(^\s*)|(\s*$)/g, "");};//去掉两边空格
if (document.form1.textfield.value.Trim()==""){
alert("搜索内容不可以为空!");
return false;
}