关于特殊的INPUT标签
1。修改,删除,设置<input type="file">这个标签的默认值?
-该值可读不可写
-清除file框里的内容
<input type=file name=ttt>
<input type=button onclick="ttt.select();document.execCommand('Delete');" value=清除file框的内容>
2。怎么过滤文件后缀<input type="file"> 让他只显示*.jpg和*.gif
<script language=javascript>
function checkImage(sId)
{
if(( document.all[sId].value.indexOf(".gif") == -1) && (document.all[sId].value.indexOf(".jpg") == -1)) {
alert("请选择gif或jpg的图象文件");
event.returnValue = false;
}
}
</script>
<form action='dddd.asp' onsubmit="checkImage('myImg')">
<input type=file id=myImg>
<input type=submit name=submit value=submit>
</form>
-该值可读不可写
-清除file框里的内容
<input type=file name=ttt>
<input type=button onclick="ttt.select();document.execCommand('Delete');" value=清除file框的内容>
2。怎么过滤文件后缀<input type="file"> 让他只显示*.jpg和*.gif
<script language=javascript>
function checkImage(sId)
{
if(( document.all[sId].value.indexOf(".gif") == -1) && (document.all[sId].value.indexOf(".jpg") == -1)) {
alert("请选择gif或jpg的图象文件");
event.returnValue = false;
}
}
</script>
<form action='dddd.asp' onsubmit="checkImage('myImg')">
<input type=file id=myImg>
<input type=submit name=submit value=submit>
</form>
浙公网安备 33010602011771号