Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- English:
- See explanation here:
- https://neculaifantanaru.com/en/how-can-i-integrate-google-search-box-to-my-website-by-implementing-custom-code.html
- -----------
- <form action="https://neculaifantanaru.com/search.html" method="get" id="site-search">
- <fieldset>
- <!-- <label for="search">Search in website</label> -->
- <input type="text" name="q" id="q" value="" />
- <button type="submit" class="btn btn-inverse">search</button>
- </fieldset>
- </form>
- -------------
- <script>
- (function() {
- var cx = 'YOUR-NUMBER-CODE';
- 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>
- -----
- <div class="main-content">
- <h1>Search the site</h1>
- <gcse:searchbox-only></gcse:searchbox-only>
- <gcse:searchresults-only></gcse:searchresults-only>
- </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement