JS 心得总结

 1、浏览器关闭事件监听(http://pengjianbo1.iteye.com/blog/507569http://bbs.csdn.net/topics/360152711

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script>
var thisPage=false;
window.onbeforeunload=function checkLeave(e){
 var evt = e ? e : (window.event ? window.event : null);        //此方法为了在firefox中的兼容
    if(!thisPage)evt.returnValue='离开会使编写的内容丢失。';
}
</script>
</head>
    <body>  
    </body>
</html>
</html>

2、删除html标签

document.getElementById("mm1").removeChild(document.getElementById("shareDiv"));

这样就无法获取shareDiv内容

 

3、HTML DOM 访问节点

http://www.w3school.com.cn/htmldom/dom_nodes_access.asp

 

4、使用超链接上传文件

<script language="javascript" type="text/javascript" src="http://www.lmjfy.com/Content/jQuery/jquery-1.7.2.min.js"></script>
<input id='up' type="file" />
<a id='btn' href="javascript:void(0);">upload</a>
 <script type="text/javascript">
$(function () {
    $('#btn').click(function(){
$('#up').click();
    });
});
</script>

由html5实现的文件上传预览功能--zyUpload

5、

 

posted @ 2015-02-05 11:22  浪荡云流  阅读(713)  评论(0编辑  收藏  举报