473,324 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

search box results in a new window

Hi,

I wish to use a dictionary.com search box and want the results of a search
to open in a new window. Is there a way to do this using their code? The
copy and paste code is provided below. Thanks for any help?

<form method="get" action="http://dictionary.reference.com/search">
<table border="0" cellspacing="4" cellpadding="4" bgcolor="#0033ff">
<tr>
<td valign="middle" align="left">
&nbsp;<strong style="font-family: arial,helvetica,sans-serif; font-size:
115%; color: #ffffff;">Search:</strong>&nbsp;
<select name="db" style="font-size:11pt; font-family:
arial,helvetica,sans-serif;">
<option value="*">Dictionary.com</option>
<option value="roget">Thesaurus.com</option>
<option value="wiki">Reference.com</option>
<option value="web">the Web</option>
</select>
&nbsp;<strong style="font-family: arial,helvetica,sans-serif; font-size:
115%; color: #ffffff;">for</strong>
&nbsp;<input type="text" name="q" size="20" maxlength="50"
style="font-size:11pt;">
&nbsp;<input type="submit" value="Go" style="font-weight:bold;
font-size:11pt; font-family: arial,helvetica,sans-serif;">
</td>
</tr>
</table>
</form>
Dec 23 '05 #1
8 2030
Is this with their permission? Or just a project for your personal
interest? Be careful of hitting someone elses' server without direct
consent. If you use their bandwidth (granted you'll be using an
insignificant amount) they may and will get pissed.

I wrote a script (server side) that parsed a site's racecar standings
into xml. I asked, never got a response so I went ahead anyway. Every
week or two during race season, the web developer rewrote the html file
so I had to rewrite the parser. Bastards!

Dec 23 '05 #2
"Someone" <no****@nospam.com> wrote in message
news:1c*****************************@40tude.net...
Hi,

I wish to use a dictionary.com search box and want the results of a search
to open in a new window. Is there a way to do this using their code? The
copy and paste code is provided below. Thanks for any help?


[snip]

Will this help? Watch for word-wrap.

<html>
<head>
<title>Dictionary.htm</title>
<script type="text/javascript">
var ref = new Array();
ref[0] = "http://dictionary.reference.com/search?q="
ref[1] = "http://thesaurus.reference.com/search?q=";
ref[2] = "http://www.reference.com/search?db=wiki&q=";
ref[3] = "http://www.reference.com/search?db=web&q=";
function formcheck() {
for (var i=0; i<4; i++) {
if (document.search_form.db[i].checked) {
var url = ref[i] + escape(document.search_form.q.value);
window.open(url,"Dictionary","");
}
}
}
</script>
</head>
<body onload="document.search_form.q.focus()">
<form name="search_form" method="get"
action="http://dictionary.reference.com/search" onsubmit="return
formcheck();">
<input type="text" name="q" value="" size="35" maxlength="256">
<input type="submit" value="Search"><br>
<input type="radio" name="db" value="*" id="d" checked>Dictionary
<input type="radio" name="db" value="roget" id="t">Thesaurus
<input type="radio" name="db" value="wiki" id="e">Encyclopedia
<input type="radio" name="db" value="web" id="w">Web
</form>
</body>
</html>
Dec 23 '05 #3
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:Kc********************@comcast.com...
"Someone" <no****@nospam.com> wrote in message
news:1c*****************************@40tude.net...
Hi,

I wish to use a dictionary.com search box and want the results of a search to open in a new window. Is there a way to do this using their code? The copy and paste code is provided below. Thanks for any help?


[snip]


Here it is with your interface but with CSS:

<html>
<head>
<title>Dictionary.html</title>
<script type="text/javascript">
var page = new Array();
page[0] = "http://dictionary.reference.com/search?q="
page[1] = "http://thesaurus.reference.com/search?q=";
page[2] = "http://www.reference.com/search?db=wiki&q=";
page[3] = "http://www.reference.com/search?db=web&q=";
function formcheck() {
var form = document.search_form;
var valu = form.q.value;
var pick = form.db.selectedIndex;
window.open(page[pick] + escape(valu),"Dictionary","");
}
</script>
<style type="text/css">
..style1 { font-family: arial,helvetica,sans-serif; font-size:115%;
font-weight: bold; color: #ffffff; padding: 10px; }
..style2 { font-size:11pt; font-family:arial,helvetica,sans-serif; }
..style3 {font-weight:bold; font-size:11pt; font-family:
arial,helvetica,sans-serif; }
</style>
</head>
<body onload="document.search_form.q.focus()">
<form method="get" name="search_form">
<table border="0" cellspacing="4" cellpadding="4" bgcolor="#0033ff">
<tr>
<td>
<span class="style1">Search:</span>
<select name="db" class="style2">
<option value="*">Dictionary.com</option>
<option value="roget">Thesaurus.com</option>
<option value="wiki">Reference.com</option>
<option value="web">the Web</option>
</select>
<span class="style1">for</span>
<input type="text" name="q" size="20" maxlength="50"
style="font-size:11pt;">
<input type="button" value="Go" class="style3" onclick="formcheck()">
</td>
</tr>
</table>
</form>
</body>
</html>
Dec 23 '05 #4
On Fri, 23 Dec 2005 16:38:20 -0600, McKirahan wrote:
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:Kc********************@comcast.com...
"Someone" <no****@nospam.com> wrote in message
news:1c*****************************@40tude.net...
Hi,

I wish to use a dictionary.com search box and want the results of a search to open in a new window. Is there a way to do this using their code? The copy and paste code is provided below. Thanks for any help?
[snip]


Here it is with your interface but with CSS:

<html>
<head>
<title>Dictionary.html</title>
<script type="text/javascript">
var page = new Array();
page[0] = "http://dictionary.reference.com/search?q="
page[1] = "http://thesaurus.reference.com/search?q=";
page[2] = "http://www.reference.com/search?db=wiki&q=";
page[3] = "http://www.reference.com/search?db=web&q=";
function formcheck() {
var form = document.search_form;
var valu = form.q.value;
var pick = form.db.selectedIndex;
window.open(page[pick] + escape(valu),"Dictionary","");
}
</script>
<style type="text/css">
.style1 { font-family: arial,helvetica,sans-serif; font-size:115%;
font-weight: bold; color: #ffffff; padding: 10px; }
.style2 { font-size:11pt; font-family:arial,helvetica,sans-serif; }
.style3 {font-weight:bold; font-size:11pt; font-family:
arial,helvetica,sans-serif; }
</style>
</head>
<body onload="document.search_form.q.focus()">
<form method="get" name="search_form">
<table border="0" cellspacing="4" cellpadding="4" bgcolor="#0033ff">
<tr>
<td>
<span class="style1">Search:</span>
<select name="db" class="style2">
<option value="*">Dictionary.com</option>
<option value="roget">Thesaurus.com</option>
<option value="wiki">Reference.com</option>
<option value="web">the Web</option>
</select>
<span class="style1">for</span>
<input type="text" name="q" size="20" maxlength="50"
style="font-size:11pt;">
<input type="button" value="Go" class="style3" onclick="formcheck()">
</td>
</tr>
</table>
</form>
</body>
</html>


Thanks for this, amazing! I have customised the code as below because
hitting enter did not work to get the results, but thanks again.

<input type="text" name="q" size="20" maxlength="50"
style="font-size:11pt;" onKeyDown="if(event.keyCode == 13) formcheck()">

Also can someone please explain what this is doing exactly, just so I am
aware.

<select name="db" class="style2"> <option value="*">Dictionary.com</option>


What's with the value of '*'?
Dec 24 '05 #5
On 23 Dec 2005 14:07:14 -0800, bobzimuta wrote:
Is this with their permission? Or just a project for your personal
interest? Be careful of hitting someone elses' server without direct
consent. If you use their bandwidth (granted you'll be using an
insignificant amount) they may and will get pissed.

I wrote a script (server side) that parsed a site's racecar standings
into xml. I asked, never got a response so I went ahead anyway. Every
week or two during race season, the web developer rewrote the html file
so I had to rewrite the parser. Bastards!


The website advertises a free search engine for use on other websites and
provides code to integrate into your web page. There is nothing saying the
code cannot be customised that I am aware of either. Linking to other sites
should never be a problem surely.
Dec 24 '05 #6
"Someone" <no****@nospam.com> wrote in message
news:1i*****************************@40tude.net...
On Fri, 23 Dec 2005 16:38:20 -0600, McKirahan wrote:
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:Kc********************@comcast.com...
"Someone" <no****@nospam.com> wrote in message
news:1c*****************************@40tude.net...
Hi,

I wish to use a dictionary.com search box and want the results of a search
to open in a new window. Is there a way to do this using their code?

The
copy and paste code is provided below. Thanks for any help?


[snip]
Thanks for this, amazing! I have customised the code as below because
hitting enter did not work to get the results, but thanks again.

<input type="text" name="q" size="20" maxlength="50"
style="font-size:11pt;" onKeyDown="if(event.keyCode == 13) formcheck()">

Also can someone please explain what this is doing exactly, just so I am
aware.

<select name="db" class="style2">
<option value="*">Dictionary.com</option>


What's with the value of '*'?


Rather than worry about key events; try this instead:

<html>
<head>
<title>Dictionary.html</title>
<script type="text/javascript">
var page = new Array();
page[0] = "http://dictionary.reference.com/search?q="
page[1] = "http://thesaurus.reference.com/search?q=";
page[2] = "http://www.reference.com/search?db=wiki&q=";
page[3] = "http://www.reference.com/search?db=web&q=";
function formcheck() {
var form = document.search_form;
var valu = form.q.value;
if (valu.length == 0) return false;
var pick = form.db.selectedIndex;
window.open(page[pick] + escape(valu),"Dictionary","");
return false;
}
</script>
<style type="text/css">
..style1 { font-family: arial,helvetica,sans-serif; font-size:115%;
font-weight: bold; color: #ffffff; padding: 10px; }
..style2 { font-size:11pt; font-family:arial,helvetica,sans-serif; }
..style3 {font-weight:bold; font-size:11pt; font-family:
arial,helvetica,sans-serif; }
</style>
</head>
<body onload="document.search_form.q.focus()">
<form method="get" name="search_form" onsubmit="return formcheck()">
<table border="0" cellspacing="4" cellpadding="4" bgcolor="#0033ff">
<tr>
<td>
<span class="style1">Search:</span>
<select name="db" class="style2">
<option value="*">Dictionary.com</option>
<option value="roget">Thesaurus.com</option>
<option value="wiki">Reference.com</option>
<option value="web">the Web</option>
</select>
<span class="style1">for</span>
<input type="text" name="q" size="20" maxlength="50"
style="font-size:11pt;">
<input type="submit" value="Go" class="style3">
</td>
</tr>
</table>
</form>
</body>
</html>
The "*" just assures that there is a value for the default selection.
Dec 24 '05 #7
McKirahan wrote:
[...]

Rather than worry about key events; try this instead:

<html>
<head>
<title>Dictionary.html</title>
<script type="text/javascript">
var page = new Array();
page[0] = "http://dictionary.reference.com/search?q="
page[1] = "http://thesaurus.reference.com/search?q=";
page[2] = "http://www.reference.com/search?db=wiki&q=";
page[3] = "http://www.reference.com/search?db=web&q=";
function formcheck() {
var form = document.search_form;
var valu = form.q.value;
if (valu.length == 0) return false;
var pick = form.db.selectedIndex;
window.open(page[pick] + escape(valu),"Dictionary","");
return false;
}
</script>
<style type="text/css">
.style1 { font-family: arial,helvetica,sans-serif; font-size:115%;
font-weight: bold; color: #ffffff; padding: 10px; }
.style2 { font-size:11pt; font-family:arial,helvetica,sans-serif; }
.style3 {font-weight:bold; font-size:11pt; font-family:
arial,helvetica,sans-serif; }
</style>
</head>
<body onload="document.search_form.q.focus()">
<form method="get" name="search_form" onsubmit="return formcheck()">
<table border="0" cellspacing="4" cellpadding="4" bgcolor="#0033ff">
<tr>
<td>
<span class="style1">Search:</span>
<select name="db" class="style2">
<option value="*">Dictionary.com</option>
<option value="roget">Thesaurus.com</option>
<option value="wiki">Reference.com</option>
<option value="web">the Web</option>


I don't understand why you use values for the options then ignore them
when accessing the array. It makes the order of the values in the
array dependent on the order of the options.

Why not use the option value as the key to an object? e.g.

var page = {
dictionary : "http://dictionary.reference.com/search?q=",
roget : "http://thesaurus.reference.com/search?q=",
wiki : "http://www.reference.com/search?db=wiki&q=",
web : "http://www.reference.com/search?db=web&q="
}
Then the function changes to:

var pick = form.db.options[form.db.selectedIndex].value;

And the order of items in the page object is independent of the order
of the options in the select.
[...]
--
Rob
Dec 24 '05 #8
"RobG" <rg***@iinet.net.auau> wrote in message
news:43***********************@per-qv1-newsreader-01.iinet.net.au...

[snip]
I don't understand why you use values for the options then ignore them
when accessing the array. It makes the order of the values in the
array dependent on the order of the options.

Why not use the option value as the key to an object? e.g.

var page = {
dictionary : "http://dictionary.reference.com/search?q=",
roget : "http://thesaurus.reference.com/search?q=",
wiki : "http://www.reference.com/search?db=wiki&q=",
web : "http://www.reference.com/search?db=web&q="
}
Then the function changes to:

var pick = form.db.options[form.db.selectedIndex].value;

And the order of items in the page object is independent of the order
of the options in the select.


Good point.

I originally posted one approach (and later merged it with the OP's)
whose form was strictly based on dictionary.com's.
Dec 24 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: NotGiven | last post by:
Say you have three pages, a search page, a results/master, and a detail page. You choose parameters on your search page and submit the page. The results show in the reults/master page. You...
2
by: Mark | last post by:
Hi Guys, I have a page with a list of links that when clicked submit data to a clients search engine, The result opens in another window and either displays a list of items or diaplays "No Items...
0
by: Steve | last post by:
C# windows I have a simple(ish) enquiry screen. on this I have a search button. I want the search window to popup as a seperate non-modal window, allow the user to search and display the...
1
by: Jack-of-all-traits | last post by:
This is a big problem and I really need help, no one seems to know how to solve this problem. I want to take the data from a record in a particular a field that contains the names of generic...
2
by: Sriram | last post by:
Hi, i am developing a search page, basically using datagrid. i have given a column as hyperlink so that when the user clicks on it, it gives the details of the selected item in a seperate page....
0
by: et | last post by:
I have a program that queries a database and displays the results in the Search window (target="_search"). That was working fine until today, for some reason, the window opens but nothing is...
5
by: manish | last post by:
HI I want a jawascript that will search pages from only my subdomain website eg. abc.efg.com can anyone help me please give the exact jawascript as I am not an expert programmer please if...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.