PDA

View Full Version : Resolved This script no longer works



ajfmrf
01-18-2012, 01:31 AM
This search won't work if you select the 'both' button.

http://www.web-user.info/search/test.html

I am thinking google has changed something?Can it be fixed or is this being done to stop everyone from using google in this way?



<html>
<head>
<title>A great search engine script-change the search engines if you want to</title>
<script type="text/javascript">
<!--
/* This script and many more are available free online at
The JavaScript Source :: http://javascript.internet.com
Created by: Ivan Iraola :: http://www.cybexmag.com */

function DoSearch() {
var Flag = 0;

if (document.ToolBox.SearchOption[0].checked==true) {
var Flag = 1;
var Engine = document.ToolBox.SearchOption[0].value;
var Query = document.ToolBox.SearchBox.value;
var locName = "http://www.google.com/search?hl=en&q=";
if (Query == "") {
alert("Please enter a search term");
return;
}
location.href = (locName + Query)
}

if (document.ToolBox.SearchOption[1].checked==true) {
var Flag = 1;
var Engine = document.ToolBox.SearchOption[1].value;
var Query = document.ToolBox.SearchBox.value;
var locName = "http://www.bing.com/search?q=";
if (Query == "") {
alert("Please enter a search term");
return;
}
location.href = (locName + Query)
}

if (document.ToolBox.SearchOption[2].checked==true) {
var Flag = 1;
var Engine = document.ToolBox.SearchOption[2].value;
var Query = document.ToolBox.SearchBox.value;
if (Query == "") {
alert("Please enter a search term");
return;
}
var searchPage = "<HTML>";
searchPage += "\n";
searchPage += "<FRAMESET ROWS=\"50%,50%\">";
searchPage += "\n";
searchPage += "<FRAME SRC=\"http://www.google.com/search?hl=en&q=" + Query + "\">";
searchPage += "\n";
searchPage += "<FRAME SRC=\"http://www.bing.com/search?q=" + Query + "\">";
searchPage += "\n";
searchPage += "</FRAMESET>";
searchPage += "\n";
searchPage += "</HTML>";
document.write(searchPage);
}

if (Flag == 0) {
alert("Please select a search engine");
}
}
//-->
</script>
</head>
<BR>
<BR>
<div align="center">
<table WIDTH=720 CELLPADDING=0 CELLSPACING=0>
<tr><td><font FACE="helvetica,arial,geneva">

<table align="center">
<tr><td>
<form name="ToolBox">
Search: <input type="text" name="SearchBox" size="22">
<input type="radio" name="SearchOption" value="Google">Google&nbsp;&nbsp;
<input type="radio" name="SearchOption" value="Bing">Bing&nbsp;&nbsp;
<input type="radio" name="SearchOption" value="Both">Both&nbsp;&nbsp;
<button type="button" onclick="DoSearch()">Search</button>

</form>
</td></tr>
</table>







</body>
</html>

ajfmrf
01-20-2012, 04:31 AM
So it works?

jscheuer1
01-20-2012, 04:59 AM
Ya, it works here, except for when you try to put Google in a frame. They no longer allow that. Nothing you can really do about it either, unless you want to use PHP to copy the page, remove whatever code is on it that makes it do that and then present that copy of the page in your frameset.

Oh, and Google may have that blocked as well.

ajfmrf
01-20-2012, 05:11 AM
I was afraid that it was not fixable.

grrr

oh well

I was hoping a javascript work around was available.

Thanks John