"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.