djmaster329
Gebruiker
- Lid geworden
- 12 mei 2009
- Berichten
- 304
Ik heb via javascript een zoekmachine van een site afgehaald.
als ik dan een zoekterm intyp komt er een popup. hoe kan ik veranderen dat het als ik op zoeken klik er onder het zoekform een vak ingevoegd word met de resultaten?
Hier heb ik het script:
het <head> deel:
het <body> gedeelte:
als ik dan een zoekterm intyp komt er een popup. hoe kan ik veranderen dat het als ik op zoeken klik er onder het zoekform een vak ingevoegd word met de resultaten?
Hier heb ik het script:
het <head> deel:
Code:
<SCRIPT language=JavaScript>
//////////////////////////////////////////////////////////////////////////////////
// //
// keyword[x] is the keyword search object //
// As of now, there is only 5 keywords //
// To add more keywords, add keyword[x], x being the number of the keyword //
// Example: To add a sixth key word, it would look like this: //
// keyword[6] = "Keyword goes here" //
// descrip[x] is the description that goes along with the keyword //
// In descrip[x], x must be equal to it's cooresponding keyword //
// Example: descrip[0] ="text text" is the description for keyword[0] //
// Add descriptions the same way you add keywords //
// //
// Don't forget to include the onLoad command in the body tag: //
// <body onLoad="search()"> //
// //
//////////////////////////////////////////////////////////////////////////////////
// To use this script freely and legally, keep the following lines intact //
// This script was created by Jeff McClay ©2001 All Rights Reserved //
////////////////////////////////////////////////////////////////////////////
function search()
{
keyword = new Array()
keyword[1] = "javascript"
keyword[2] = "mengerink"
keyword[3] = "animaties"
keyword[4] = "gastenboek"
keyword[5] = "telefoongids"
keyword[6] = "gedichten"
keyword[7] = "forum"
num = 1
descrip = new Array()
descrip[1] = "<P ALIGN=justify>Deze site is gemaakt met javascript. Je kunt de mooiste javascripts vinden in mijn javascript verzameling. Je wilt hem wilt bekijken? <A HREF=http://home.wanadoo.nl/java.script/ TARGET=top> Klik dan hier.</a></p>"
descrip[2] = "<P ALIGN=justify>Heel veel informatie over deze naam kunt u vinden bij <A HREF=http://mengerg.speed.planet.nl/mengweb/ TARGET=top> De Mengerink website</a>"
descrip[3] = "<P ALIGN=justify>Je zoekt mooie animated gifs? Zoek dan niet verder. De mooiste gifs geselecteerd op onderwerp kun je vinden bij Henks animated gifs. Je wilt ze bekijken? <A HREF=http://home.wanadoo.nl/de.animaties/ TARGET=top> Klik daarvoor hier.</a></p>"
descrip[4] = "<P ALIGN=justify>Je zoekt mijn gastenboek? Zoek dan niet verder! <A HREF=http://bezoek.write2me.nl/ TARGET=top> Klik daarvoor hier.</a></p>"
descrip[5] = "<P ALIGN=justify>Je zoekt een telefoonnummer? <A HREF=http://www.detelefoongids.com/ TARGET=top> Klik daarvoor hier.</a></p>"
descrip[6] = "<P ALIGN=justify>Je zoekt mooie gedichten? Zoek dan niet verder. Ga naar de site met gedichten van Monique. <A HREF=http://members.home.nl/monique210/ TARGET=top> Klik daarvoor hier.</a></p>"
descrip[7] = "<P ALIGN=justify>Je zoekt een forum? <A HREF=http://forum.faqman.nl/messages/board-topics.html TARGET=top> Klik daarvoor hier.</a></p>"
<!------DON'T EDIT------>
var openwindow = window.open ("","open",config="height=300,width=400, scrollbars=no, scrolling=no")
var query = document.srch.ursrch.value.toLowerCase();
var found = false
<!----END DON'T EDIT---->
///////////////////////////////////////////////////////////////////////////////////////
// //
// If you added more keywords, and descriptions, you must add another if statement //
// that cooresponds with the keyword and descrip //
// Example: //
// If you added keyword[6] and descrip[6], you must also add: //
// //
// if (guess == keyword[5]) {num = 5} //
// //
///////////////////////////////////////////////////////////////////////////////////////
if (query == keyword[1]) {num = 1; found = true}
if (query == keyword[2]) {num = 2; found = true}
if (query == keyword[3]) {num = 3; found = true}
if (query == keyword[4]) {num = 4; found = true}
if (query == keyword[5]) {num = 5; found = true}
if (query == keyword[6]) {num = 6; found = true}
if (query == keyword[7]) {num = 7; found = true}
<!------DON'T EDIT------>
if (found == true)
{
openwindow.document.write("<HTML>")
openwindow.document.write("<TITLE>Zoekresultaten over: " +query+ "</title>")
openwindow.document.write("<BODY BGCOLOR=FFFFEC>")
openwindow.document.write("<H2><B><CENTER>Gevonden informatie over " +keyword[num]+ "</b></h2>")
openwindow.document.write("<HR WIDTH=85%</center>")
openwindow.document.write(descrip[num])
openwindow.document.write ("<FORM><CENTER>")
openwindow.document.write ("<INPUT type='button' value='Close' onClick = 'self.close()'>")
openwindow.document.write ("</CENTER></FORM><P> <P> <P> <P> <P> <P> <P> <P> <P> ")
openwindow.document.write("</body>")
openwindow.document.write("</html>")}
if (found == false)
{
openwindow.document.write("<HTML>")
openwindow.document.write("<TITLE>Zoekresultaten over: " +query+ "</title>")
openwindow.document.write("<BODY BGCOLOR=FFFFEC>")
openwindow.document.write("<H2><B><CENTER>Geen informatie gevonden over " +query+ "</b></h2>")
openwindow.document.write("<HR WIDTH=85%</center>")
openwindow.document.write("Zoek bij Yahoo naar <A HREF=http://search.yahoo.com/bin/search?p=" +query+ " TARGET=top>" +query+ "</a><BR>")
openwindow.document.write("Zoek bij Goto naar <A HREF=http://www.goto.com/d/search/p/go/?Partner=go_home&Keywords=" +query+ " TARGET=top>" +query+ "</a><BR>")
openwindow.document.write("Zoek bij WebCrawler naar <A HREF=http://search.excite.com/search.gw?lk=webcrawler&s=" +query+ " TARGET=top>" +query+ "</a><BR>")
openwindow.document.write("Zoek bij Looksmart naar <A HREF=http://www.looksmart.com/r_search?look=&key=" +query+ " TARGET=top>" +query+ "</a><BR>")
openwindow.document.write ("<FORM><CENTER>")
openwindow.document.write ("<INPUT type='button' value='Close' onClick = 'self.close()'>")
openwindow.document.write ("</CENTER></FORM><P> <P> <P> <P> <P> <P> <P> <P> <P> ")
openwindow.document.write("</body>")
openwindow.document.write("</html>")}}
<!----END DON'T EDIT---->
</SCRIPT>
Code:
<FORM name=srch>
<div align="center">
<center>
<TABLE borderColor=#000000 cellSpacing=1 cellPadding=5 width=225 bgColor=#ffffff
border=1 bordercolorlight="#000000">
<TBODY>
<TR>
<TD bgColor=#000000 colSpan=2 style="color: #FF0000; font-family: Arial Black">
<B>Doorzoek de database</B></TD></TR>
<TR>
<TD bgColor=#000000 style="color: #FF0000; font-family: Arial Black">Keyword:</TD>
<TD bgColor=#000000 style="color: #FF0000; font-family: Arial Black"><INPUT name=ursrch></TD></TR>
<TR>
<TD align=middle bgColor=#000000 colSpan=2 style="color: #FF0000; font-family: Arial Black"><INPUT onclick=search() type=submit value="Start het zoeken"></TD></TR></TBODY></TABLE></center>
</div>
</FORM>