本页是js命名空间首页。与js、ajax等有关的内容放此命名空间下。

导航

JS小技巧

  1. 复制内容到剪切板
function setCopy(_sTxt){try{clipboardData.setData('Text',_sTxt); alert("网址粘贴成功!");}catch(e){}}
  1. 数组定义: var a = [a,b] ;
  1. 加入收藏
     <a href="javascript:window.external.AddFavorite('http://www.soften.cn/','红麦软件')">添加收藏</a>
    
  1. 设为首页
     <a href="###" onClick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.soften.cn/');">设为首页</a>
    

JS兼容问题

  1. 得到某个对象的绝对坐标
function GetPoint(source)
{
  var tmp = source;
  var pt = new Object();
  if(source.getBoundingClientRect)
  {
     var rc = source.getBoundingClientRect();
     pt.x = rc.left - 2;
     pt.y = rc.top - 2;    
  }
  else
  {
    pt.x = 0;
    pt.y = 0;
    do
    {
      pt.x += tmp.offsetLeft;
      pt.y += tmp.offsetTop;
      tmp = tmp.offsetParent;
    }
    while(tmp != null && tmp.tagName!="BODY");
  }
  return pt;
}

资料

  1. 非常多的js效果,拖拽等 http://www.dhtmlgoodies.com/index.html
  2. 无忧脚本 http://bbs.51js.com/
  3. lightbox2 http://www.huddletogether.com/projects/lightbox2/ 这个不错,包括图片、组图、div、iframe、ajax几种方式的处理
  4. thickbox http://jquery.com/demo/thickbox/ ThickBox is a webpage UI dialog widget written in JavaScript on top of the jQuery library. Its function is to show a single image, multiple images, inline content, iframed content, or content served through AJAX in a hybrid modal.
js/start.txt · 最后更改: 2009/11/18 05:54 由 alex_best
到顶部
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0 红麦软件 红麦软件