将javascript值传递到html链接

将javascript值传递到html链接,javascript,variables,text,Javascript,Variables,Text,我假设这只是初学者的问题,我想将变量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

我假设这只是初学者的问题,我想将变量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>')

document.write(“在每个
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>')
document.write('您的浏览器似乎无法正确处理帧,但您可以直接转到调查')

请发布更多代码!