<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>不同类型文件上传</title>
<script type=text/javascript>
function info(form){
alert(11111);
var optr=document.getElementById('select').value;
var type=document.getElementById('shortPic').value.split(".");
type =type[type.length-1];
if (optr =="") {
alert("请选择上传的类型");
return false;
}
if (optr ==0 && type=="") {
alert("请选择上传的文件");
return false;
}
if (optr==1 && type!=="html") {
alert("请选择 网页的");
return false;
}
if (optr==2&& (type!=="jpg" && type!=="ogp")) {
alert("请选择图片的");
return false;
}
if (optr ==3&& (type!=="ava"&& type!== "map3")) {
alert("请选择视频的");
return false;
}
if (optr==4&& type=="text") {
alert("请选择档案类型的");
return false;
}
if (optr==5&& (type!=="doc"&&type!=="text")){
alert("请选择资料类型的");
return false;
}
};
</script>
<body>
<form onsubmit="return info(this)">
<select id="select">
<option value="0">请选选择</option>
<option value="1">网页</option>
<option value="2">图片</option>
<option value="3">视频</option>
<option value="4">档案</option>
<option value="5">资料</option>
</select>
<input type="file" name="shortPic" value="" id="shortPic"/>
<br/>
<input type="submit" value="submit" id="shortPic1">
</form>
</body>
</head>
</html>