Script Script Description:
Add the following code to the <body> area
<script language= "JavaScript" >
var key = "";
function Makeentry () {
This. Date = "";
This. Name= "";
This. URL = "";
This. Desc = "";
This. Category = "";
return this;
}
function Makearray (n) {
This.length = n;
for (var k = 1; k <= N; k++) {
This[k] = "";
}
return this;
}
function Makelinks (size) {
This.length = size;
for (var r=1; r<= size; r++) {
THIS[R] = new Makeentry ();
THIS[R]. Date = Datesarray[r];
THIS[R]. Name = Namesarray[r];
THIS[R]. URL = Urlsarray[r];
THIS[R]. Desc = Descarray[r];
}
return this;
}
var linksize=0
Datesarray = new Makearray (linksize);
Namesarray = new Makearray (linksize);
Urlsarray = new Makearray (linksize);
Descarray = new Makearray (linksize);
var arraycount=0
Arraycount + 1
Datesarray[arraycount] = "5/30/2000"
Urlsarray[arraycount] = "Http://www.163.net"
Namesarray[arraycount] = "NetEase"
Descarray[arraycount] = "163 netease yeah 126 Chinese"
Alert (Arraycount)
Arraycount + 1
Datesarray[arraycount] = "5/30/2000"
Urlsarray[arraycount] = "http://www.sina.com.cn"
Namesarray[arraycount] = "Sina net"
Descarray[arraycount] = "Sina net chat chatting news Super"
Alert (Arraycount)
Arraycount + 1
Datesarray[arraycount] = "5/30/2000"
Urlsarray[arraycount] = "http://www.sohu.com"
Namesarray[arraycount] = "Sohu"
Descarray[arraycount] = "Sohu Net Chat News"
Alert (Arraycount)
Linksize = Arraycount;
----End data-------
function ShowAll (linkobj) {
for (var S=1; s<= linkobj.length; s++) {
Showlink (linkobj,s);
}
}
function Showlink (links, index) {
document.write ("<table border>");
document.write ("<tr><td>" + links[index]. Date + "</td>");
document.write ("<td><a href=" + links[index). URL + ">" + links[index]. Name + "</a></td>");
document.write ("<td>" + links[index]. Desc + "</td></tr>");
document.write ("</table>");
}
function searchlinks (links, keyword) {
document.write ("Search Result:" +keyword + "<br>");
document.write ("<table border>");
for (var q=1; q<=links.length; q++) {
document.write (q+ ".")
if (links[q). Url.indexof (keyword)!=-1) {
document.write ("Search Results for Keyword:" +keyword+ "<br>" +links[q]. Name + "<p>")
document.write ("Search Result:" +keyword+ "<br>");
Showlink (LINKS,Q);
Continue
}
if (links[q). Desc.indexof (keyword)!=-1) {
Showlink (LINKS,Q);
Continue
}
if (links[q). Date.indexof (keyword)!=-1) {
Showlink (LINKS,Q);
Continue
}
if (links[q). Name.indexof (keyword)!=-1) {
Showlink (LINKS,Q);
Continue
}
}
document.write ("</table>");
}
Final Stuff
The main program---
JSI = new Makelinks (linksize);
document.write ("<title> in-site query </title>");
Searchlinks (JSi, prompt ("Input query Keywords:", "Input query Keywords:"));
document.write ("document.write ("Press <b>search again</b> again to inquire document.write ("<form><input Type=button ></form>");
Show All Links
document.write ("<table border>");
ShowAll (JSI);
document.write ("</table>");
</script>