随笔分类 -  javascript

常见的javascript问题
摘要:<script>function newimage(obj) { a = new Image(); var objectURL = window.URL.createObjectURL(obj.files[0]); var img= document.getElementById('img')img.src = objectURL; a.src = objectURL;img.onload=function (){alert(img.width)}}</script><input id="idcardfile" type=&qu 阅读全文
posted @ 2012-06-05 11:56 3H 阅读(232) 评论(0) 推荐(0)
摘要:<!doctype html> <html> <head> <meta content="text/html; charset=GBK" http-equiv="Content-Type" /> <title>Image preview example</title><style type="text/css"> div {width:100px;height:100px;border: 1px #A3BFE7 solid;} img {width:a 阅读全文
posted @ 2012-06-05 11:55 3H 阅读(230) 评论(0) 推荐(0)
摘要:str为要去除空格的字符串:去除所有空格: str = str.replace(/\s+/g,""); 去除两头空格: str = str.replace(/^\s+\s+$/g,"");去除左空格:str=str.replace( /^\s*/, '');去除右空格:str=str.replace(/(\s*$)/g, "");转载自:三味书屋 阅读全文
posted @ 2012-05-10 10:43 3H 阅读(175) 评论(0) 推荐(0)
摘要:创建的节点,一时不知道如何删除。。。耗了一大堆时间for(var i = 0; i < jsonList.length; i++ ){ var li_button = document.createElement("li"); li_button.className = "button"; var li_button_a = document.createElement("a"); li_button_a.id = jsonList[i]._id; var li_button_text = document.createText 阅读全文
posted @ 2012-03-15 17:15 3H 阅读(330) 评论(0) 推荐(0)