basic search form

L

Luke

Hi I'm using the following to generate a form. User enters search term
and a url will be open


<script type="text/javascript">
function ScopusSearchGo(){
var url="http://gateway.ovid.com.libproxy1.nlb.gov.sg/ovidweb.cgi?
T=JS&amp;NEWS=N&amp;PAGE=titles&amp;SEARCH=";
var url2=".mp&amp;D=econ"
var searchInputscopus = document.getElementById("ScopusSearchInput");
document.location=url + encodeURIComponent(searchInputscopus.value) +
url2;
}</script>

<div>

<div id="enterText" style="position: absolute; left: -1000em; width:
20em;">Enter your search terms:</div>
<input type="text" id="ScopusSearchInput" size="30"
onKeyPress="handleKeyPress(event,this.form)" />
<input type="button" value="Search" onclick="ScopusSearchGo()"/>

</div>

My limited understanding is that it will open in the browser, the part
that says "url" + whatever is typed + the part that says url2. Is that
correct?

It seems to work fine. But currently it replaces the page i am on.
What do i change to make it open a new tab or even window? (I'm not
picky, either will do).

Thanks
 
D

Doug Gunnoe

Hi I'm using the following to generate a form. User enters search term
and a url will be open

<script type="text/javascript">
function ScopusSearchGo(){
var url="http://gateway.ovid.com.libproxy1.nlb.gov.sg/ovidweb.cgi?
T=JS&amp;NEWS=N&amp;PAGE=titles&amp;SEARCH=";
var url2=".mp&amp;D=econ"
var searchInputscopus = document.getElementById("ScopusSearchInput");
document.location=url + encodeURIComponent(searchInputscopus.value) +
url2;

}</script>

<div>

  <div id="enterText" style="position: absolute; left: -1000em; width:
20em;">Enter your search terms:</div>
      <input type="text" id="ScopusSearchInput" size="30"
onKeyPress="handleKeyPress(event,this.form)" />
  <input type="button"  value="Search" onclick="ScopusSearchGo()"/>

</div>

My limited understanding is that it will open in the browser, the part
that says "url" + whatever is typed + the part that says url2. Is that
correct?

It seems to work fine. But currently it replaces the page i am on.
What do i change to make it open a new tab or even window? (I'm not
picky, either will do).

Thanks

Why not use a real form, like so ?

<form action="http://gateway.ovid.com.libproxy1.nlb.gov.sg/
ovidweb.cgi" method="get" target="_blank">
<input type="hidden" name="T" value="JS" />
<input type="hidden" name="NEWS" value="N" />
<input type="hidden" name="PAGE" value="TITLE" />
<input type="text" name="SEARCH" />
<input type="submit" value="Click me" />
</form>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top