...

View Full Version : new guy - newb java help



adminguy
09-30-2011, 10:13 PM
Hello all, I am an admin, and I am building a radial button search option on a webpage. It works fine, except I cant seem to get it to open the results in a new window. I tried using the "window.open" but it didnt work. Any assitance would be appreciated! Also, I am not a great java programmer, and what you see below is the extent of my knowledge :)
Thanks in Advance!!

===================CODE===============
<html>
<body>
<script language="JavaScript">eng = 'http://www.google.com/search?q=';</script>
Search:
<input type="text" id="searchterms">
<input type="button" value="Search" onload="" onclick="window.location = eng + escape(document.getElementById('searchterms').value); return false;">
<br />
<input type="radio" onclick="eng = this.value;" checked name="sengines"
value="http://www.google.com/search?q=" />Google
<input type="radio" onclick="eng = this.value;" name="sengines"
value="http://support.citrix.com/search/basic/?searchQuery=" />CTX KB
<input type="radio" onclick="eng = this.value;" name="sengines"
value="http://support.microsoft.com/search/default.aspx?mode=r&query=" />MS KB
</body>
</html>

xelawho
10-01-2011, 12:10 AM
onclick="window.open(eng + escape(document.getElementById('searchterms').value)); return false;"

Philip M
10-01-2011, 07:33 AM
This is the JavaScript forum. Java and Javascript are entirely different programming languages, in spite of the confusingly similar names. Rather like Austria and Australia!

You mean a radio button - not a radial button.


All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

Old Pedant
10-01-2011, 11:17 PM
As a minor point, there is no reason to use return false from an <input type="button">. Buttons don't perform any action at all except what you provide for them in JavaScript. Yes, you do need the return false for <input type="submit">, but not for button.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum