JS笔记

//文本复制

'plugin/ZeroClipboard.js'
var clip = new ZeroClipboard.Client();

clip.setText(this.node.text.value);

clip.setHandCursor(true);
clip.setCSSEffects(true);

clip.addEventListener('complete', function(client, text){
alert("ÑûÇëÁ´½ÓÒѸ´ÖƵ½ÄúµÄ¼ôÌù°å£¡");
});

clip.glue(this.copyBtnId);

se(window).resize(function(){
clip.reposition();
});

//正则
var reg = new RegExp("(\\?|&)"+ name +"=([^&#]*)");
url = url.replace(reg, '$1'+ name +'='+ value);

//防止冒泡和避免默认行为

e.stopPropagation()
e.preventDefault()

//文档碎片

var frag = document.createDocumentFragment()

//鼠标所在的元素对象

e = window.event || e;
var obj = e.srcElement || e.target;
if(obj.tagName == 'A' && obj.id != _showMoreTag_btn_id){

}

//点击空白处隐藏#pop对应的元素

$(document).bind("click", function(e){
  var target = $(e.target);
  if(target.closest(".pop").length == 0){
    $("#pop").hide();
  }
});

posted @ 2013-05-28 18:07  郎涛  阅读(156)  评论(0编辑  收藏  举报