Originally want to use array to save data, did not try to use JS to data structure, use JS to try it.
JS efficiency is really very low a list of 1000 objects browser prompts you to run slowly.
Before think Ajax3d quite use the foreground, now it seems to have not been popular will die prematurely. With Delphi development of the game people feel too slow, not to mention the use of JS.
Here is a list of the links I've implemented:
Copy Code code as follows:
/* @author Eric
* @mail shmilyhe@163.com
*blog.csdn.net/shmilyhe
*/
<script>
function Student (no,name) {
This.id=no;
This.name=name;
THIS.SCORES={CHINESE:0,MATH:0,ENGLISH:0};
}
function List () {
This.head=null;
This.end=null;
This.curr=null;
}
List.prototype.add=function (o) {
var tem={ob:o,next:null};
if (this.head) {
This.end.next=tem;
This.end=tem;
}else{
This.head=tem;
This.end=tem;
This.curr=tem;
}
}
List.prototype.del=function (Inde) {
var N=this.head;
for (Var i=0;i<inde;i++) {
N=n.next;
}
N.next=n.next.next?n.next.next:null;
}
List.prototype.next=function () {
var te=null;
if (This.curr) {
Te=this.curr.ob; This.curr=this.curr.next;}
return te;
}
List.prototype.hasnext=function () {
if (this.curr.ob!=null) return true;
return false;
}
var list=new list ();
for (Var i=0;i<1000;i++) {
List.add (New Student (i, ' name ' +i));
}
var i=0;
while (List.hasnext ()) {
Document.writeln (List.next (). name);
if (i==10) {Document.writeln (' <br/> '); i=0}
i++;
}
</script>