2011-12-19 3 views
0

페이지 위치를 가져 오는 동적 fb와 비슷한 버튼을 만들려고합니다. 그러나 html의 data-href 요소를 대체하는 가장 좋은 방법을 찾고 있습니다. REPLAC 할 top.location.href 수있는 것이다 JS 방법facebook을 top.location.href와 같은 버튼으로 렌더링합니다.

  1. <div class="fb-like" data-href='' data-send="true" data-colorscheme="dark" data-width="450" data-show-faces="true"></div>

top.location.href :

나는 퍼즐의 두 조각을 전자 데이터 요소, 그리고 같은 버튼을 페이 스북 렌더링?

답변

1

평소처럼 하시겠습니까?

document.getElementById("the_like_button").setAttribute("data-href", new_value); 

나 :

$("#the_like_button").attr("data-href", new_value); 

당신이 jQuery를 선호하는 경우

.

관련 문제