空格问题

我想判断当输入are you ok?这样的句子时可以提交,而当输入只输入一串空格时不能提交。
---------------------------------------------------------------

str=replace(str," "," ")
---------------------------------------------------------------

if trim(document.formName.inputName.value) <> "" then
'提交
else
'不提交
end if
---------------------------------------------------------------

作一个替换,
str=replace(request("str")," ","&nbsp;")
---------------------------------------------------------------

String.prototype.trim = function()
{
if(this==null ¦ ¦ this=="")
return ""

return this.replace(/(^\s*) ¦(\s*$)/g, "");
}

function checkSearch(){
if (document.searchForm.content.value.trim.length==0)
{alert("您想输点什么呢?");return false;}
if (searchForm.content.value.trim==""){
alert("请您输入项目名称!");
searchForm.content.focus();}
else
window.open('search.asp?content='+searchForm.content.value+'');
}

---------------------------------------------------------------

function Save_onclick
if Trim(formEdit.ypmc.value)="" then
msgbox "用品名称不能为空。",vbExclamation,"提示"
formEdit.ypmc.focus
exit function
end if
if Trim(formEdit.lbbh.value)="" or Trim(formEdit.lbbh.value)="xxxxxx" then
msgbox "请选择一种类别!",vbExclamation,"提示"
formEdit.lbbh.focus
exit function
end if
if not IsNumeric(formEdit.kcbj.value) then
msgbox "请输入整形的数字",vbExclamation,"提示"
formEdit.kcbj.select
exit function
else
if instr(1,formEdit.kcbj.value,".") then
msgbox "请输入整形的数字",vbExclamation,"提示"
formEdit.kcbj.select
exit function
end if
end if
formEdit.submit
End function

Published At
Categories with Web编程
comments powered by Disqus