【发布时间】:2017-01-11 07:32:59
【问题描述】:
好的,我有一个文本框,根据您单击的按钮,将显示数组中的文本
var Text= new Array();
Text[1]="a"
Text[2]="b"
Text[3]="c"
function Anzeige(x) {
document.getElementById("Text").innerHTML = Text[x];
}
.......
<input type="button" value="x" onclick="Anzeige(1)">
<input type="button" value="y" onclick="Anzeige(2)">
<input type="button" value="z" onclick="Anzeige(3)">
............
<div id="Anzeigefeld">
<div id="Text"></div>
</div>
到目前为止一切顺利,一切都按计划进行,但现在我想使用“Text[1]="for more informations look <a style="color:blue;" href="insertlinkhere">here</a>”之类的链接,但它只是停止工作(当我单击按钮时什么也没有发生。
请帮忙?
【问题讨论】:
-
onclick 属性始终为 javascript。
-
可能是关于引号的。试试
'for more informations look <a style="color:blue;" href="insertlinkhere">here</a>'
标签: javascript html arrays hyperlink