【发布时间】:2020-03-12 16:09:21
【问题描述】:
试图让我的变量“产品”中的链接与我屏幕上的蓝色“链接 naar 网站”一起使用。相反,它显示为粗体文本......我无法点击。
var product = [
'plantenwinkel.nl',
'https://www.plantenwinkel.nl/image/data/templates/plantenwinkel/plantenwinkel.jpg',
'6,30',
'gratis',
'https://www.plantenwinkel.nl/krulpitrus-juncus-effusus-spiralis-siergras?utm_source=tradetracker&utm_medium=affiliate&utm_campaign=feed&option=57498'
];
document.getElementById("product_logo").innerHTML = '<img src="'+product[1]+'" alt="'+product[0]+'" />';
document.getElementById("product_prijs").innerHTML = '<p>€ '+product[2]+'</p>';
document.getElementById("product_verzendkosten").innerHTML = '<p>'+product[3]+'</p>';
document.getElementById("product_link").innerHTML = '<link rel="stylesheet" href="'+product[4]+'">Link naar website</link>'; //Why doesn't this link work??!?!?!?
【问题讨论】:
-
您需要
<a>标签。<link>标签用于添加样式表
标签: javascript innerhtml getelementbyid