Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Just one input box

Posted on 1998-10-31
3
Medium Priority
?
171 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 600 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

Find out what you should include to make the best professional email signature for your organization.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

783 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