Скрипт поиска по сайту - не могу переделать!(((
Вложений: 1
Ищет нормально, только ключевые слова вводяться в какое-то окно. Но мне надо, чтобы было как-то так: http://javascript.ru/forum/attachmen...1&d=1230571926
Помогите, плиз! |
Сам скрипт:
Это в HEAD <style type="text/css"> A:link { color: #003399; text-decoration: underline } A:visited { color:#003399; text-decoration: underline } A:hover { color:#003399; text-decoration: none } .copy { font: 8pt/normal Verdana, Arial, Helvetica, sans-serif; text-transform: super; text-decoration: none; color: #333333} .copy1 { font: bold 10pt/normal Verdana, Arial, Helvetica, sans-serif; text-transform: super; text-decoration: none; color: #333333 } .copy2 { font: 9pt/normal Verdana, Arial, Helvetica, sans-serif; text-transform: super; text-decoration: none; color: #333333 } </style> [B]Это в BODY[/B] <div align="center"> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr> <td align="center" class="copy1" valign="top"> Демонстрационная версия! </td> </tr> <tr> <td class="copy2" valign="top"> <br><br><br> <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] = "1/1/97 " /* Адрес в Интернет */ urlsArray[arraycount] = "http://www.yahoo.com" /* Название */ namesArray[arraycount] = "Yahoo" /* Описание */ descArray[arraycount] = "Лучший и самый большой каталог ресурсов" /* И так далее */ //alert(arraycount) arraycount += 1 datesArray[arraycount] = "1/1/97 " urlsArray[arraycount] = "http://www.lycos.com" namesArray[arraycount] = "Lycos" descArray[arraycount] = "Хорошая поисковая система" //alert(arraycount) arraycount += 1 datesArray[arraycount] = "1/1/97 " urlsArray[arraycount] = "http://www.webcrawler.com" namesArray[arraycount] = "Webcrawler" descArray[arraycount] = "Неплохой поисковик" //alert(arraycount) arraycount += 1 datesArray[arraycount] = "1/1/97 " urlsArray[arraycount] = "http://www.search.com" namesArray[arraycount] = "Search.com" descArray[arraycount] = "Коллекция тысяч поисковых систем." //alert(arraycount) arraycount += 1 datesArray[arraycount] = "1/1/97 " urlsArray[arraycount] = "http://altavista.digital.com" namesArray[arraycount] = "AltaVista" descArray[arraycount] = "У этой поисковой системы самая большая база данных" //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=1>"); document.write("<tr><td class='copy2'>" + links[index].Date +"</td>"); document.write("<td class='copy1'><a href=" + links[index].URL +">" + links[index].Name + "</a></td>"); document.write("<td class='copy2'>" + links[index].Desc + "</td></tr>"); //document.write("</table>"); } function searchLinks(links, keyword){ document.write("Результат поиска для: " +keyword +"<br>"); document.write("<table>"); for (var q=1; q<=links.length; q++) { //document.write(q+".") if (links[q].URL.indexOf(keyword) != -1){ // document.write("Результат поиска для: "+keyword+ "<br>" +links[q].Name +"<p>") //document.write("Результат поиска для: "+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>Результат поиска</title><body bgcolor=white>"); searchLinks(jsi, prompt("Введите слово) \rИщите с нами:","Слово, фразу, букву, дату")); document.write("<hr>"); document.write("Поиск произведен во всех строках"); document.write("<form><input type=button onClick='history.go(0)' value='Искать снова'></form>"); // show all the links //document.write("<table border>"); //showAll(jsi); //document.write("</table>"); </script> <br><br><br> </td> </tr> </table> <table border="0" width="500" cellspacing="2" cellpadding="2"> <tr> <td align="center" class="copy" valign="top"> <hr noshade size="1"> <a href="http://www.cgi.ru">Посетите наш сервер и подпишитесь на наши рассылки!</a> <hr noshade size="1"> 2000 Copyright © <a class="copy" href="http://www.cgi.ru">scriptsnetwork</a>. All rights reserved.<br> </td> </tr> </table> </div> |
Часовой пояс GMT +3, время: 02:17. |