Created
April 18, 2015 13:41
-
-
Save RadianSmile/31f03f72db562f28481f to your computer and use it in GitHub Desktop.
Element V2: Custom Search Engine Results-only Layout Demo// source http://jsbin.com/noyura
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Element V2: Custom Search Engine Results-only Layout Demo</title> | |
<style type="text/css"> | |
h4.warning {color: red;} | |
h4.recommendation {color: green;} | |
</style> | |
<!-- Put the following javascript before the closing </head> tag. --> | |
<script> | |
(function() { | |
var cx = '011702641394353158763:9zkle_pnhea'; | |
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = false; | |
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + | |
'//www.google.com/cse/cse.js?cx=' + cx; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); | |
})(); | |
</script> | |
</head> | |
<body> | |
<!-- Search box form --> | |
<form style="display:none" onsubmit="return executeQuery();" id="cse-search-box-form-id"> | |
<!-- This is the input searc box --> | |
<input type="text" id="cse-search-input-box-id" size="25" autocomplete="off" value="周祝瑛"/> | |
<!-- This is the search button --> | |
<input type="submit" value="Search"/> | |
</form> | |
<script type="text/javascript" | |
src="http://www.google.com/cse/brand?form=cse-search-box-form-id&inputbox=cse-search-input-box-id"> | |
</script> | |
<!-- End of Google branding watermark --> | |
<!-- Element code snippet --> | |
<script type="text/javascript"> | |
function executeQuery() { | |
var input = document.getElementById('cse-search-input-box-id'); | |
var element = google.search.cse.element.getElement('searchresults-only0'); | |
if (input.value == '') { | |
element.clearAllResults(); | |
} else { | |
element.execute(input.value); | |
} | |
return false; | |
} | |
setTimeout(executeQuery,3000); | |
//document.forms["myform"].submit(); | |
</script> | |
<!-- Place this tag where you want the search results to render --> | |
<gcse:searchresults-only></gcse:searchresults-only> | |
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Element V2: Custom Search Engine Results-only Layout Demo</title> | |
<style type="text/css"> | |
h4.warning {color: red;} | |
h4.recommendation {color: green;} | |
</style> | |
<\!-- Put the following javascript before the closing </head> tag. --> | |
<script> | |
(function() { | |
var cx = '011702641394353158763:9zkle_pnhea'; | |
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = false; | |
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + | |
'//www.google.com/cse/cse.js?cx=' + cx; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s); | |
})(); | |
<\/script> | |
</head> | |
<body> | |
<\!-- Search box form --> | |
<form style="display:none" onsubmit="return executeQuery();" id="cse-search-box-form-id"> | |
<\!-- This is the input searc box --> | |
<input type="text" id="cse-search-input-box-id" size="25" autocomplete="off" value="周祝瑛"/> | |
<\!-- This is the search button --> | |
<input type="submit" value="Search"/> | |
</form> | |
<script type="text/javascript" | |
src="//www.google.com/cse/brand?form=cse-search-box-form-id&inputbox=cse-search-input-box-id"> | |
<\/script> | |
<\!-- End of Google branding watermark --> | |
<\!-- Element code snippet --> | |
<script type="text/javascript"> | |
function executeQuery() { | |
var input = document.getElementById('cse-search-input-box-id'); | |
var element = google.search.cse.element.getElement('searchresults-only0'); | |
if (input.value == '') { | |
element.clearAllResults(); | |
} else { | |
element.execute(input.value); | |
} | |
return false; | |
} | |
setTimeout(executeQuery,3000); | |
//document.forms["myform"].submit(); | |
<\/script> | |
<\!-- Place this tag where you want the search results to render --> | |
<gcse:searchresults-only></gcse:searchresults-only> | |
</body> | |
</html> | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment