Solved

Just one input box

Posted on 1998-10-31
3
160 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now