脚本説明:次のようなコードを領域に追加 <br>var key = "";</p> <p><br></p> <p>function makeEntry (){<br>this.Date = "";<br>this.Name="";<br>this.URL = "";<br>this.Desc = "";<br> this.Category = "";<br>return this;<br>}</p> <p>function makeArray(n) {<br>this.length = n;<br>for (var k = 1; k this[k] = "";<br>}<br>return this;<br>}</p> <p>function makeLinks(size) {<br>this.length = size;<br>for (var r=1; rthis[r] = new makeEntry();<br>this[r].Date = daysArray[r];<br>this[r].Name = namesArray[r];<br>this[r].URL = urlsArray[r];<br>this[r].Desc = descArray[r];<br>}<br>これを返す;<br>}</p> <p><br>var linksize=0</p> <p>datesArray = new makeArray(linksize);<br>namesArray = new makeArray(linksize);<br>urlsArray = new makeArray(linksize);<br> descArray = new makeArray(linksize);</p> <p><br>var arraycount=0</p> <p><br>arraycount += 1 <br>datesArray[arraycount] = "5/30/2000"<br>urlsArray[arraycount] = "http://www.163. net"<br>namesArray[arraycount] = "网易"<br>descArray[arraycount] = "163 netease ええ 126 chinese "<br>//alert(arraycount)</p> <p>arraycount += 1 <br>datesArray[arraycount] = "5/30/2000 " <br>urlsArray[arraycount] = "http://www.sina.com.cn"<br>namesArray[arraycount] = "新浪网"<br>descArray[arraycount] = "sina net chat chating news super"<br>//alert(arraycount) </p> <p>arraycount += 1 <br>datesArray[arraycount] = "5/30/2000"<br>urlsArray[arraycount] = "http://www.sohu.com"<br>namesArray[arraycount] = "搜狐"<br>descArray[arraycount] = "sohu net chat news "<br>//alert(arraycount)</p> <p>linksize = arraycount;</p> <p>// ----データ終了 -------</p> <p>function showAll(linkobj) {<br>for (var s =1; sshowLink(linkobj,s);<br>}<br>}</p> <p>function showLink (リンク, インデックス) {<br>//document.write("<table border>");<br>document.write("<tr> ;<td>" + links[index].Date +"</td>");<br>document.write("<td><a href="http://www.php1.cn/" >document.write("</p> <td>" + links[index].Desc + "</td><</tr>");<br/>//document.write("</table>"); <br/>}</p><p>function searchLinks(リンク, キーワード){<br/>document.write("搜寻结果: " +keyword +"<br>");</p><p>document.write("<表の枠線>");<br>for (var q=1; q//document.write(q+".")<br>if (links[q].URL.indexOf(keyword) != -1){<br>/ / document.write("キーワードの検索結果: "+keyword+ "<br>" +links[q].Name +"<p>")<br/>//document.write("搜寻结果: "+keyword+ " <br>" );<br>showLink(links,q);<br>続行;<br>}<br>if (links[q].Desc.indexOf(keyword) != -1) {<br>showLink(links,q);<br>続行;<br>}<br>if (links[q].Date.indexOf(キーワード) != -1) {<br>showLink(links,q);<br>続行;<br>}<br>if (links[q].Name.indexOf(キーワード) != -1) {<br>showLink(links,q);<br>Continue;<br>}<br>}<br>document.write("</table>");<br>}<p><br>// 最後の部分<br>// メインプログラム---</p> <p>jsi = new makeLinks(linksize);<br>document.write("<title>站内查询</title>");<br>searchLinks(jsi,prompt("输入查询关键字:","输入查询关键字:"));<br>document.write("<hr>");<br>document.write("按<b>再検索</b>再次查询<hr>");<br>document。 write("<form><input type=button onClick='history.go(0)' value='再検索'></form>");</p> <p>// すべてのリンクを表示します<br>// document.write("<table border>");<br>//showAll(jsi);<br>//document.write("</table>");</p> <p> 以上は站内搜索脚本例子二(javascript)_Javascript教程的内容,更多相关内容请关注PHP中文网(m.sbmmt.com)!