![](/img/trans.png)
[英]Django/JavaScript: passing hidden variables to a page with window.location.href?
[英]Passing Javascript variable to '<a href' with 'window.location.href' in a frame
正如標題所示,我想用javascript傳遞一個變量,但在一個框架中我以前有這個代碼:
<a href="page.php" target="frame" onClick="$('#frame').show()">
現在我想傳遞一個變量,下面的代碼可以傳遞變量,但是在另一個窗口中,但我希望它在同一幀中。
<a href="page.php" target="frame" onClick="location.href=this.href+'?var='+X;">
我想你可以使用:
document.getElementById('frame').contentWindow.location.href...
更改框架的href(並傳遞您的變量),但我很確定如果您使用的是查詢字符串,則需要刷新。
也許如果你附加一個哈希( #var=something
)而不是一個在沒有刷新的情況下工作的查詢字符串?
請注意,如果您跨域執行框架內容,這可能根本不起作用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.