Solved

Just one input box

Posted on 1998-10-31
3
164 Views
Last Modified: 2010-04-09
Hi there,

Many search engines enable you to place an input box and link to their sites. This way you can search their data bases. One often sees pages with many input boxes beneath each other.
I want to create a page with just one input box and a pull-down menu. One must be able to <select> one of the options (just like on the home pages of Netscape and Microsoft). How can I do this?

Below I have included the code for *separate* links to AltaVista and Excite.


<HTML>
<HEAD><TITLE>Search</TITLE>
</HEAD>
<BODY>
<CENTER>
<TABLE CELLSPACING=0 CELLPADDING=0 WIDTH=500><TR><TD>&nbsp;</TD></TR><TR><TD VALIGN=top><A href="http://www.altavista.digital.com">Alta Vista</a><BR></TD><TD VALIGN=top><font size=3> <FORM method=GET action="http://www.altavista.digital.com/cgi-bin/query"> <INPUT TYPE="hidden" NAME="pg" VALUE="q"><INPUT NAME="q" SIZE=30 MAXLENGTH=200 VALUE="">&nbsp;<INPUT TYPE =submit VALUE="  Search  "><INPUT TYPE="hidden" NAME="what" VALUE="web"><INPUT TYPE="hidden" NAME="fmt"  VALUE=""></FORM></font>
</TD></TR>

<TR><TD VALIGN=top>
<a href="http://www.excite.com">Excite</a><br></TD>
<TD VALIGN=top><FONT SIZE=3><FORM ACTION="http://www.excite.com/search.gw" METHOD=POST><INPUT TYPE="hidden" NAME="searchType" VALUE="Concept"><INPUT NAME="search" SIZE=30>&nbsp;<INPUT TYPE="submit" NAME="submit" VALUE="  Search  "><INPUT TYPE="hidden" NAME="category" VALUE="default"><INPUT TYPE="hidden" NAME="mode" VALUE="relevance"><INPUT TYPE="hidden" NAME="showqbe" VALUE="1"><INPUT TYPE="hidden" NAME="display" VALUE="msn,hb"></FORM></FONT>
</TD></TR>

</FORM></FONT>
</TD></TR></TABLE>
</CENTER>
</BODY>
</HTML>

Thanks in advance

0
Comment
Question by:Maas
  • 2
3 Comments
 
LVL 1

Accepted Solution

by:
borup earned 150 total points
ID: 1839329
You need a Javascript or CGI-Script to redirect the user to the chosen site. I have made a Javascript which does what you want. To add a new site you just need to add a new option. You can't get it easier :-)

borup

<HTML>
<HEAD>
  <TITLE>Search</TITLE>
</HEAD>

<BODY>

<SCRIPT>
<!--

function doSearch() {
  index = document.searchForm.site.selectedIndex;
  site = document.searchForm.site[index].value;
  searchString = document.searchForm.searchString.value;
 
  location.href = site + searchString;
}

//-->
</SCRIPT>

<CENTER>

<FORM NAME="searchForm">

<TABLE CELLSPACING=0 CELLPADDING=0>
  <TR>
    <TD>
      <INPUT TYPE="TEXT" NAME="searchString" SIZE=30 MAXLENGTH=200>
    </TD>
    <TD>
      <SELECT NAME="site">
        <OPTION VALUE="http://www.altavista.com/cgi-bin/query?pg=q&q=">Alta Vista
        <OPTION VALUE="http://search.excite.com/search.gw?trace=1&search=">Excite
      </SELECT>
    </TD>
    <TD>
      <INPUT TYPE="BUTTON" VALUE="Search" onClick="doSearch();">
    </TD>
  </TR>
</TABLE>

</FORM>

</CENTER>

</BODY>
</HTML>
0
 

Author Comment

by:Maas
ID: 1839330
Thanks a lot borup!! It really can't get easier.
0
 
LVL 1

Expert Comment

by:borup
ID: 1839331
You're welcome ;-)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to delete "dots" above Bootstrap 3 navbar 4 52
Html value of radio 14 27
AJAX Wordpress Not Reading Variable 2 27
Set time on Session (ASP) 14 21
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question