开发者

current url javascript binding into html

开发者 https://www.devze.com 2023-01-01 14:42 出处:网络
http://pastebin.com/KejQT7XQ i am tryin开发者_开发技巧g to bind current url of my page to this html

http://pastebin.com/KejQT7XQ

i am tryin开发者_开发技巧g to bind current url of my page to this html how can i do that


You may want to try to create your iframe dynamically:

<html>
 <head>
  <script type="text/javascript">
   function insertFbButton() {
    f = document.createElement("IFRAME");
    f.setAttribute(
     "src",
     "http://www.facebook.com/plugins/like.php?"
     + window.location.href
     + "&amp;layout=button_count&amp;show_faces=true&amp;width=450"
     + "&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=21"
    );
    f.style.width = 450+"px";
    f.style.height = 210+"px";
    document.body.appendChild(f);
   }
  </script>
 </head>
 <body>
  <p>Content</p>
  <script>insertFbButton();</script>
  <p>Content</p>
 </body>
</html>


Use window.location.href or window.location.pathname expressions if you don't need the full url

0

精彩评论

暂无评论...
验证码 换一张
取 消