<SCRIPT LANGUAGE="javascript">
<!--//
function validate(){
var invalid = " "; //非法字符是空格你可以改为其它字符或数字
if (document.submitform.filename.value.indexOf(invalid) > -1) {
alert("文件名不能含有空格!");
return false;
}
else {
return true;
}
}
// -->
</script>
<form name=submitform onSubmit="return validate()">
<input type=file name=filename>
<p>
<input type=submit value="Submit">
</form>
|