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
相关文档:
JavaScript的实现的Map,用着挺方便的,不知道性能怎么样。
自己用只有不超过10个元素,所以性能无所谓了。
/********************jsmap.js**************************/
/////// map 类
function classMap() {
this.map = new Array();
var struct = function(key,
value){
& ......
注意:Option中的O是要大写的,不然语法报错
1.动态创建select
function createSelect(){
var mySelect = document.createElement("select");
mySelect.id = "mySelect"; ......
js对文字进行编码涉及3个函数:escape,encodeURI,encodeURIComponent,相应3个解码函数:unescape,decodeURI,decodeURIComponent
1、 传递参数时需要使用encodeURIComponent,这样组合的url才不会被#等特殊字符截断。 ......
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 ......