Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="test"></div>
- <script>
- var myCallback = function() {
- if (document.readyState == 'complete') {
- // Document is ready when CSE element is initialized.
- // Render an element with both search box and search results in div with id 'test'.
- google.search.cse.element.render({
- div: "test",
- tag: 'search'
- });
- } else {
- // Document is not ready yet, when CSE element is initialized.
- google.setOnLoadCallback(function() {
- // Render an element with both search box and search results in div with id 'test'.
- google.search.cse.element.render(
- {
- div: "test",
- tag: 'search'
- });
- }, true);
- }
- };
- // Insert it before the CSE code snippet so that cse.js can take the script
- // parameters, like parsetags, callbacks.
- window.__gcse = {
- parsetags: 'explicit',
- callback: myCallback
- };
- (function() {
- var cx = '008717607452966325908:cegvvfhkhvk'; // Insert your own Custom Search engine ID here
- var gcse = document.createElement('script'); gcse.type = 'text/javascript';
- gcse.async = true;
- 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>
- #test input {
- font-size: 32px;
- color: red;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement