JavaScript 判断上传文件类型
function
Check_FileType(str)
{
var
pos
=
str.lastIndexOf(
"
.
"
);
var
lastname
=
str.substring(pos,str.length) //此处文件后缀名也可用数组方式获得str.split(".")
if
(lastname.toLowerCase()
!=
"
.jpg
"
&&
lastname.toLowerCase()
!=
"
.gif
"
)
{
alert(
"
您上传的文件类型为
"
+
lastname
+
"
,图片必须为.jpg,.gif类型
"
);
document.myform.pic.focus();
return
false
;
}
else
{
return
true
;
}
}
http://www.cnblogs.com/SList/archive/2005/11/09/272164.html
相关文档:
一般我們寫Notes For Web 程式時很長用到URL傳遞一些資訊,在Release 6 多支援了@UrlQueryString的公司來直接抓取URL參數,真是好用的公式阿.不過使用這個當然還是吃Server的資源(效能),能用 JavaScript ......
大家都知道,.NET中一些Web服务器控件解析并编译,最终被渲染的时候,其实是转化成了普通的html控件,比如<asp:LinkButton>控件就被渲染成了<a>锚点控件,这里要讲的DropDownList控件也一样,被渲染成了普通的select控件,在如下的asp.net页面中定义了一个web服务器控件DropDownList和一个普通的select控件(主 ......
<!--JavaScript 调用客户端应用程序-->
<script type="text/javascript">
function exec(command)
{
window.oldOnError = window.onerror;  ......
Struts Validator Framework provides an easy-to-use mechanism for performing client-side validation. It's very useful to validate some fields on the client-side before sending the data to the server for processing. By this way we can ensure that the data send to the server is valid. Performing valida ......