출처 : http://kin.naver.com/qna/detail.nhn?d1id=1&dirId=1040202&docId=147983455&qb=c25zIOuztOuCtOq4sA==&enc=utf8&section=kin&rank=2&search_sort=0&spq=1


<script type="text/javascript">
 function init_sns(sns_main){
  if(!document.getElementById(sns_main)) return;
  var HOST = location.protocal + "//" + location.host;
  var HREF = location.href;
  if(document.getElementsByTagName("title")[0]){
   var TITLE = encodeURIComponent(document.getElementsByTagName("title")[0].innerHTML);
  } else TITLE = "";
  
  var FACEBOOK = "http://www.facebook.com/sharer/sharer.php?u=" + HREF;
  var TWITTER = "http://twitter.com/share?text=" + TITLE + "&url=" + HREF;
  var ME2DAY = "http://me2day.net/posts/new?new_post[body]=" + TITLE + ":" + HREF + "&new_post[tags]=" + HOST;
  var MSN = "http://profile.live.com/badge?url=" + HREF + "&text=" + TITLE;
  var CYGONGAM = "http://csp.cyworld.com/bi/bi_recommend_pop.php?url=" + HREF + "&title_nobase64=" + TITLE;
  var YOZM = "http://yozm.daum.net/api/popup/prePost?sourceid=54&link=" + HREF + "&prefix=" + TITLE;
  
  var html = [];
  html.push('<ul>');
  html.push(' </li><img id="sns_facebook" src="images/sns/facebook.gif" alt="facebook" /></li>');
  html.push(' </li><img id="sns_twitter" src="images/sns/twitter.gif" alt="twitter" /></li>');
  html.push(' </li><img id="sns_me2day" src="images/sns/me2day.gif" alt="me2day" /></li>');
  html.push(' </li><img id="sns_cygongam" src="images/sns/cygongam.gif" alt="cygongam" /></li>');
  html.push(' </li><img id="sns_yozm" src="images/sns/yozm.gif" alt="yozm" /></li>');
  html.push('</ul>');
  document.getElementById(sns_main).innerHTML = html.join("\n");
  
  var sns = document.getElementById(sns_main).getElementsByTagName("img");
  for(var i=0; i<sns.length; i++){
   sns[i].style.cursor = "pointer";
   sns[i].onclick = function(){
    switch(this.id){
     case "sns_facebook":
      window.open(FACEBOOK, "facebookWindow");
      break;
     case "sns_twitter":
      window.open(TWITTER, "twitterWindow");
      break;
     case "sns_me2day":
      window.open(ME2DAY, "me2dayWindow");
      break;
     case "sns_cygongam":
      window.open(CYGONGAM, "cygongamWindow", "width=400, height=364, scrollbars=no, resizable=no");
      break;
     case "sns_yozm":
      window.open(YOZM, "yozmWindow", "width=466, height=356, scrollbars=no, resizable=no");
      break;
    }
   }
  }
 }
</script>

<body>
<!-- sns button -->
<div id="sns_main"><script type="text/javascript">init_sns("sns_main");</script></div> 
</body>