试图在我的变量“产品”中获取链接,以便在屏幕上以蓝色显示“ Link 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
标签,更改此:
document.getElementById("product_link").innerHTML = '<link rel="stylesheet" href="'+product[4]+'">Link naar website</link>';
收件人:
document.getElementById("product_link").innerHTML = '<a href="'+product[4]+'">Link naar website</a>';
我同意他的解决方案是正确的。