View Full Version : How to open in new window (webster search)

11-27-2008, 03:58 AM
I hope I am in the correct place

I am adding merriam-webster search to my page and I would like the search to open in a new window but I can't figure out how.

I already tried target="_base"
but when the new window opens it only loads a blank page.

Here is my html code

<!-- Merriam-Webster Searchbox Style 9 -->
<script language="Javascript">
function getValue(term){if(document.query.elements[0].checked == true){document.location.href = "http://www.merriam-webster.com/dictionary/" + term;}
else if(document.query.elements[1].checked == true){document.location.href = "http://www.merriam-webster.com/thesaurus/" + term;}}
<form name="query" method="get" action="javascript:getValue(document.query.va.value)">
<div style="margin:0;padding:0;border:solid 1px #000000;width:502px;">
<div style="margin:0;padding:0;background-color:#dfe6ff;">
<table cellpadding="0" cellspacing="0" style="margin:0;padding:0;font-family:Geneva,Arial,Helvetica,sans-serif;font-size:11px;font-weight:bold;color:#010066;">
<td style="margin:0;padding:0;" width="150">
<img src="http://www.merriam-webster.com/images/searchbox/hdr_500x32.gif" width="149" height="32" hspace="0" vspace="0" align="left" />
<td width="175" align="center" valign="middle" style="margin:0;padding:3px;vertical-align:middle;">
<input type="radio" name="mySelect" value="Dictionary" checked>Dictionary
<input type="radio" name="mySelect" value="Thesaurus">Thesaurus
<td width="175" valign="middle" style="margin:0;padding:3px;vertical-align:middle;">
<input type="text" align="top" name="va" size="24">
<input type="image" src="http://www.merriam-webster.com/images/searchbox/btn_go_19x18_blue_matte.gif" alt="Go" width="19" height="18" border="0" style="vertical-align:-25%;">

Thanks for any help

11-27-2008, 06:33 AM
it's target="_blank"

Major Payne
11-27-2008, 06:55 PM
target="_blank" is for frame or transitional doctypes only. Since you are using JS already, you could use:
onclick="window.open (this.href, ''); return false"

11-27-2008, 07:25 PM
I suggest you have a peek at one of my favorite articles (http://diveintoaccessibility.org/day_16_not_opening_new_windows.html) regarding the problems with opening new windows. Plus it's really annoying.

Major Payne
11-28-2008, 04:31 AM
Technically, modern day browsers can not be made to do what a web site wants when a link is clicked and that is the way it should be. User should have control over their browser's actions...not a web site!

I have my browsers' options set to open links the way I want them to be open. I also do not allow JavaScript to be turned on unless I click the little button to do so. Even then, I control what JS runs on each page. Therefore, the onClick events do not work for me.

Users have the option to right-click any link and chose from the context menu to open in a new tab or window. I personally use the keyboard keys that give me the option I want before clicking the link.