繁体   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