我必须在 javascript 警报弹出窗口中显示字符串数组,该弹出窗口将显示字符串索引或序列号,然后在字符串数组值之后显示空格,然后换行。然后以相同的方式显示该数组字符串中的所有值。我的代码不起作用。
function Test(Str)
{
for(var i = 1; i <= Str.length; i++)
alert("Str["+i+"]: "+Str[i],"/n");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Submit" runat="server" Text="Submit" onclick="Submit_Click" />
</div>
C#:
protected void Submit_Click(object sender, EventArgs e)
{
string[] Str = new string[5];
Str[0] = "string1";
Str[1] = "string2";
Str[2] = "string3";
Str[3] = "string4";
Str[4] = "string5";
Submit.Attributes.Add("onclick", "javascript:Test(Str);");
}
i need dispaly in following way:
1: string1
2: string2
3: string3
4: string4
5: string5
javascript 弹出窗口不起作用。我怎样才能做到这一点..