簡體   English   中英

將javascript值傳遞給html鏈接

[英]passing javascript value into html link

我認為這只是一個初學者問題,我想將我的變量urlvar1的值添加到鏈接中。 但是看起來這不起作用。

document.write('<iframe id="frame" src="http://www.xxx.xx?ATID="'+urlvar1+'" title="project" frameborder="no" border="0">Your browser does not seem to handle frames properly, but you can go directly to the survey <a href="http://www.xxx.xx?ATID="'+urlvar1+' ">here</a>')

你有一個額外的雙引號"在每個href屬性。

它目前的內容如下:

href="http://www.xxx.xx?ATID="string"

它應該讀作:

href="http://www.xxx.xx?ATID=string"

請參閱下面的工作字符串:

document.write('<iframe id="frame" src="http://www.xxx.xx?ATID='+urlvar1+'" title="project" frameborder="no" border="0">Your browser does not seem to handle frames properly, but you can go directly to the survey <a href="http://www.xxx.xx?ATID='+urlvar1+'">here</a>')

暫無
暫無

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

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