#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    3
    Rep Power
    0

    Exclamation 2 Google CSE on one page


    First this is a combination of a JavaScript and an HTML problem. I posted here because it is mainly JavaScript. Here is my problem:

    I have 2 Google custom search engines - videos and images. I am trying to set it up so that when I click the the image button it shows the image search and vise versa. When I click the image button it does nothing... Here is what I have:

    Code:
    <html>
    	<head>
    		<title>Timberwolf Mega Search</title>
    		<script type="text/javascript">
    			function video()
    			{
    				var vidScript = document.createElement("script");
    				vidScript.type = "text/javascript";
    				vidScript.src = "http://www.google.com/cse/cse.js?cx=015090151345644370844:avkvldyk9t4";
    				vidScript.id = "vidScript";
    				var imgScript = document.getElementById("imgScript");
    				document.getElementById("searchscript").replaceChild(vidScript, imgScript);
    				document.getElementById("results").innerHTML = "<gcse:searchresults webSearchSafesearch=\"off\" webSearchResultSetSize=\"20\"></gcse:searchresults>";
    				document.getElementById("vid").innerHTML = "Videos";
    				document.getElementById("img").innerHTML = "<button onClick=\"image()\">Images</button>";
    			}
    			function image()
    			{
    				var imgScript = document.createElement("script");
    				imgScript.type = "text/javascript";
    				imgScript.src = "http://www.google.com/cse/cse.js?cx=015090151345644370844:aqjept-5mio";
    				imgScript.id = "imgScript";
    				var vidScript = document.getElement("vidScript");
    				document.getElementsById("searchscript").replaceChild(imgScript, vidScript);
    				document.getElementById("results").innerHTML = "<gcse:searchresults disableWebSearch=\"true\" safeSearch=\"off\" imageSearchResultSetSize=\"20\"></gcse:searchresults>";
    				document.getElementById("vid").innerHTML = "<button onClick=\"video()\">Videos</button>";
    				document.getElementById("img").innerHTML = "Images";
    			}
    			function init()
    			{
    				var vidScript = document.createElement("script");
    				vidScript.type = "text/javascript";
    				vidScript.src = "http://www.google.com/cse/cse.js?cx=015090151345644370844:avkvldyk9t4";
    				vidScript.id = "vidScript";
    				document.getElementById("searchscript").appendChild(vidScript);
    				document.getElementById("results").innerHTML = "<gcse:searchresults webSearchSafesearch=\"off\" webSearchResultSetSize=\"20\"></gcse:searchresults>";
    				document.getElementById("vid").innerHTML = "Videos";
    				document.getElementById("img").innerHTML = "<button onClick=\"image()\">Images</button>";
    			}
    		</script>
    		<style>
    			td
    			{
    				border: 0;
    				text-align: center;
    			}
    			html, body
    			{
    				background-color: #750000;
    				color: #FFFFFF;
    			}
    		</style>
    	</head>
    	<body onload="init()">
    		<p><font color="FF0000">WARNING: RESULTS NOT FILTERED</font></p>
    		<p><a href="http://ip-programs.com/viewforum.php?f=53">Return to Online Tools</a></p>
    		<br />
    		<table border="1">
    			<tr>
    				<td width="75px"><div id="vid">LOADING...</div></td>
    				<td width=".5px" style="background-color: white;"></td>
    				<td width="75px"><div id="img">LOADING...</div></td>
    			</tr>
    		</table>
    		<hr />
    		<div id="searchscript"></div>
    		<div style="width: 98%;">
    			<gcse:searchbox></gcse:searchbox>
    			<div id="results"></div>
    		</div>
    	</body>
    </html>
    Any and all help is appreciated.


    Sincerely,
    Timberwolf Programmers
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    3
    Rep Power
    0

    bump


    bump
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    3
    Rep Power
    0

    bump


    bump

IMN logo majestic logo threadwatch logo seochat tools logo