2012-06-13 42 views
-2
textarea onclick="this.focus(); this.select();" rows="1" cols="100" readonly="readonly" style="background: #ffffcc; font-family: Monospace;"> 
a href="http://127.0.0.1:8000/ajax/share?url=......" onclick="window.open(this.url, 'blabla', 'width=600,height=400');"> 
/textarea> 

我想製作一些類似Twitter的插件。我的意思是這個最簡單的'Tweet this。' 這是一個代碼粘貼,但我現在沒有如何採取當前網站的網址。也許一個JavaScript,但如何?你能修改我的代碼嗎?我自己的'分享它'插件

回答

2

您可以從window.location.href獲取當前頁面的網址:

<button onclick="window.open('http://myUrl?from='+window.location.href)"> 
    Click! 
</button>