O ASP usa matrizes de clientes para armazenar dados, eu já vi muitos aplicativos. Mas essa tecnologia atraiu minha atenção recentemente quando eu estava estudando vários sistemas de aliança de trânsito.
Em seguida, falarei sobre como usá -lo. Primeiro, darei um exemplo de simplesmente aplicar JavaScript sem combinar ASP.
1.js
A cópia do código é a seguinte:
vara = newArray ();
vartemp = "<table>";
a [0] = newArray (1, "ah huinan", "masculino");
a [1] = newArray (2, "Little White Rabbit", "Feminino");
a [2] = newArray (3, "xiaoqi", "feminino");
for (vari = 0; i <a.Length; i ++)
{
temp = temp+"<tr>"
for (varj = 0; j <a [0] .Length; j ++)
{
temp = temp+"<td>"+a [i] [j]+"</td>";
}
temp = temp+"</tr>"
}
temp = temp+"</ table>";
document.write (temp);
1.html
A cópia do código é a seguinte:
<html>
<head>
<metahttp-equiv = "content-type" content = "text/html; charset = gb2312"/>
<title> armazenando dados com matrizes </title>
</head>
<Body>
<scriptLanguage = "javascript" type = "text/javascript" src = "1.js"> </script>
</body>
</html>
1.html Resultado de saída:
1 Ah Huinan
2 Little White Rabbit Girl
3 Little Qi Girl
Vendo o resultado da saída, você pode pensar que devemos começar com esse arquivo JS. Sim, colocamos o <scriptlanguage = "javascript" type = "text/javascript" src = "1.js"> </sCript> em 1.html
Altere para <scriptLanguage = "javascript" type = "text/javascript" src = "1.asp"> </sCript>
Salvar 1.js como 1.asp e faça as seguintes modificações:
A cópia do código é a seguinte:
vara = newArray ();
vartemp = "<table>";
<%
Código de conexão do banco de dados, conexão aberta
Fori = 1to3
Ifobjrs.eofthenexitfor
%>
a [<%= i%>] = newArray (<%= objrs (0)%>, "<%= objrs (1)%>", "<%= objrs (2)%>")
<%