Code for storing data using arrays in ASP

Source: Internet
Author: User

ASP stores data using client arrays. I have seen many such applications. But this technology caught my attention when I recently studied several sets of traffic exchange alliance systems.

Next I will talk about how to use it. First I will give an example of simply applying JavaScript without integrating ASP.
1. jsCopyCodeThe Code is as follows: var A = new array ();
VaR temp = "<Table> ";
A [0] = new array (1, "A Hui Nan", "male ");
A [1] = new array (2, "White Rabbit", "female ");
A [2] = new array (3, "Xiaoqi", "female ");
For (VAR I = 0; I <A. length; I ++)
{
Temp = temp + "<tr>"
For (var j = 0; j <A [0]. length; j ++)
{
Temp = temp + "<TD>" + A [I] [J] + "</TD> ";
}
Temp = temp + "</tr>"
}
Temp = temp + "</table> ";
Document. Write (temp );

1.html copy Code the code is as follows:


store data in arrays




output result of 1.html:
1 ahui Nan male
2 white rabbit
3 Xiao Qi female
script language = "JavaScript" type = "text/JavaScript" src = "1.js">
replace it with
. save JS as 1. ASP and make the following changes: copy Code the code is as follows: var A = new array ();
var temp ="














{< br> temp = temp + " ";
}< br> temp = temp + "
"
}< br> temp = temp + "
"; <% database connection code, open the connection for I = 1 to 3 If objrs. EOF then exit for %> A [<% = I %>] = new array (<% = objrs (0) %>, "<% = objrs (1) %>", "<% = objrs (2) %>") <% objrs. movenext next %> for (VAR I = 0; I <. length; I ++) {< br> temp = temp + " " for (VAR J = 0; j
" + A [I] [J] + "
";
document. write (temp);

I didn't post the complete ASP code. I only wrote a little bit. Please add it by yourself.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.