簡體   English   中英

如何返回onclick函數是javascript中href的結果?

[英]How to return the onclick function is result to href in javascript?

現在,我在Twitter上共享的代碼如下所示:

<span class='st_twitter_large' st_via="mediajobscom" st_url="" onclick="window.location.href=myURL;" displayText='Tweet'></span>

和我使用的腳本:

<script>
var myURL = document.URL+"&featuredid={$listing.Title}&featured=true";                    
</script>  

當我現在單擊共享按鈕時,它將重新加載頁面,並添加我的參數featuredid和featured.I,我需要將此值返回到st_url =“”,以便共享包含參數的新結果鏈接。

非常感謝你的幫助! 哈姆扎

var myURL = document.URL+"&featuredid={$listing.Title}&featured=true";

使用javascript替換st_twitter_large類中的st_url屬性:

document.getElementsByClassName("st_twitter_large")[0].setAttribute("st_url", myURL);

JSP JSTL

[英]JSP JSTL <a href call Onclick Javascript function

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM