반응형
function openNewsWin(openUrl) { var winObj; winObj = window.open(openUrl,"sendNewsWin","width=1024, height=800"); } function openNewsWin2(openUrl) { var winObj; winObj = window.open(openUrl,"sendNewsWin","width=700, height=600, scrollbars=yes, resizable=yes, menubar=yes, toolbar=yes, statusbar=yes"); } function openNewsWin3(openUrl) { var winObj; winObj = window.open(openUrl,"sendNewsWin","width=466, height=356"); } function sendNews(media,locTitle,locUrl) { //openNewsWin,openNewsWin2,openNewsWin3는 각자 알맞게 수정하시면됩니다. if(locUrl == undefined){ locUrl = window.location.href; } if(locTitle == undefined){ locTitle = encodeURI(document.title); }else{ locTitle = encodeURI(locTitle); } locTag = encodeURI("태그명"); switch(media) { case "twitter": sendUrl = "http://twitter.com/home?status="+ locTitle +"+"+encodeURI(locUrl); openNewsWin(sendUrl); break; case "metoday": sendUrl = "http://me2day.net/posts/new?new_post[body]=\""+ locTitle +"\":"+encodeURI(locUrl)+"&new_post[tags]="+locTag; openNewsWin(sendUrl); break; case "naver": sendUrl = "http://bookmark.naver.com/post?ns=1&title="+ locTitle +"&url="+encodeURI(locUrl); openNewsWin(sendUrl); break; case "google": sendUrl = "http://www.google.com/bookmarks/mark?op=add&title=\""+ locTitle +"\"&bkmk="+encodeURI(locUrl); openNewsWin(sendUrl); break; case "cyworld": sendUrl = "http://csp.cyworld.com/bi/bi_recommend_pop.php?url="+ locUrl +"&title="+locTitle+"&thumbnail=&summary= &writer="; openNewsWin2(sendUrl); break; case "facebook": sendUrl = "http://www.facebook.com/sharer.php?u="+encodeURI(locUrl)+"&data_title="+ locTitle +""; openNewsWin2(sendUrl); break; case "yozm": sendUrl = "http://yozm.daum.net/api/popup/prePost?prefix="+encodeURI(locTitle)+"&link="+ encodeURI(locUrl) +""; openNewsWin3(sendUrl); break; } }
반응형
'Web > JAVASCRIPT' 카테고리의 다른 글
링크 테두리 없애기 (0) | 2017.04.13 |
---|---|
JavaScript [알고리즘]퀵 정렬(Quick Sort) (0) | 2017.01.16 |
encodeURI, encodeURIComponent, escape 함수 차이점 (0) | 2011.10.07 |
javascript 원하는 부분만 인쇄하기 (0) | 2011.08.08 |
숫자만 입력 받기 (0) | 2011.07.17 |