这里是阵列使用JavaScript/jQuery来改变在按钮的div文字点击
var copyText= [
'this is the first line',
'Simply put, the second line',
'impressed by the third line.'
];
这些不工作...
$("#thisbutton").click(function() {
$("#thetext").innerHTML("meow meow");
});
或
$("#thisbutton").click(function() {
$("#thetext").innerHTML(copyText[1]);
});
或
$("#thisbutton").click(function() {
$("#thetext").text(copyText[1]);
});
$("#thisbutton").click(function() {
$("#thetext").html(copyText[1]);
});
我失踪了什么? THKS。
请公布源代码的其他页面上。另外,你可能想要把整个东西包装在$(function(){// code here})中; – 2010-11-28 03:44:51
谢谢,是的,这就是它。怎么样href和一个链接,如何可以访问一个javascript数组? <!DOCTYPE HTML>
<脚本类型= “文本/ JavaScript的”> $(函数(){ VAR htmlLinks = [ 'http://cnn.com', ' http://youtube.com', 'http://facebook.com' ]; }); htmlLinks[0];" target="_blank"> link1 \ htmlLinks[1];" target="_blank"> link2 \ htmlLinks[2];" target="_blank"> link3 – windsurf88 2010-11-28 16:33:30