Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Empty search box

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #187086
    Eriaku
    Participant

    Hi guys, i have the search box ready to do but its not working, here is you can check it out :

        <!-- begin search box -->
        <div class="box">
          <h2>صندوق البحث</h2>
          <form action="#ads">
            <input type="text" name="s" id="s" value="" />
            <button type="submit">اذهب</button>
          </form>
        </div>
        <!-- end search box -->

    Pretend that my website is http://www.css-tricks.com

    Thank you (f)

    #187087
    __
    Participant

    “not working” is a useless statement:
    it means nothing on its own.

    http://codepen.io/adrian-enspired/pen/rHLgB

    …nothing unexpected there. Describe your problem in specific terms. What are you trying to accomplish?

    #187125
    Eriaku
    Participant

    Well, the thing is when i go to my website and write something in the search box to search for it, after clicking OKAY .. nothing happens, this is why i thought that it’s not working ..
    Can you please tell if there is something wrong with the code ?

    #187127
    Paulie_D
    Member

    Well, the thing is when i go to my website and write something in the search box to search for it, after clicking OKAY .. nothing happens

    You know these boxes don’t work automatically…..right?

    You have to use javascript to tell them too do something.

    #187128
    Eriaku
    Participant

    Sorry but i don’t have any javascript files in my website files, all i have is some html pages and two css files with a folder that has all the images, is something wrong with these files ?
    How about the javascript and how i can have it ?
    I appreciate your help

    #187130
    Paulie_D
    Member

    How about the javascript and how i can have it ?

    Google is your friend here. – https://www.google.com/cse/

    We’re not a code writing site.

    #187131
    __
    Participant

    Typically, a search box is nothing more than a form with a text input. In order to do anything, that form must be submitted to your (a) server, which must then perform the search and return the results. It is not a “simple” process, and it will depend entirely on how your particular site is designed and run.

    Especially since you currently have no server-side scripting for your site, you might be interested in using google’s site search service instead.

    edit – Paulie_D beat me to it. : )

    #187133
    Eriaku
    Participant

    Thank you so much for your feedback, i tried the one of google and it was a little bit confusing, and now, i need your help to match between google search code and my code, here we go :
    Google code :
    &lt;script&gt;
    (function() {
    var cx = '000954822679884360703:to7re88yauo';
    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);
    })();
    &lt;/script&gt;
    &lt;gcse:search&gt;&lt;/gcse:search&gt;
    <code></code>

    My code :
    &lt;!-- begin search box --&gt;
    &lt;div class="box"&gt;
    &lt;h2&gt;صندوق البحث&lt;/h2&gt;
    &lt;form action="#ads"&gt;
    &lt;input type="text" name="s" id="s" value="" /&gt;
    &lt;button type="submit"&gt;اذهب&lt;/button&gt;
    &lt;/form&gt;
    &lt;/div&gt;
    &lt;!-- end search box --&gt;
    <code></code>

    Thank you guy’s

    #187142
    Eriaku
    Participant

    Guy’s, if this is not possible then just tell me and will be fine, and i apologize for the leak of knowledge that i have about this whole concept

    #187147
    __
    Participant

    This might be the answer you’re looking for.

    Have you seen Google’s getting started guide?

    #187242
    Eriaku
    Participant

    Hi, yeah ive seen the getting started guide but it did not help me much ..
    what im asking is, i want to keep the search box design of my website and put inside it the script from google CSE, is it possible ?

    This one from my website :

    
        <!-- begin search box -->
          <div class="box">        
          <h2>صندوق البحث</h2>
          <form action="#ads">
            <input type="text" name="s" id="s" value="" />
            <button type="submit">اذهب</button>
          </form>
        </div>
        <!-- end search box -->
    
    

    And this one from google :

    
    <script>
      (function() {
        var cx = '000954822679884360703:to7re88yauo';
        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>
    <gcse:search></gcse:search>
    
    #187249
    __
    Participant

    The gcse script builds a search box based on the options (including design/ theme) you choose. You might be able to do some limited customization from your end, but you can’t change the way their script works.

    What does the gcse box look like? is it really so bad that it’s unusable? even with what customizations it offers?

    #187307
    Eriaku
    Participant

    Yeah i mean it’s not the the theme of my website, its different, then the google cse search box when you write its too small, it’s not large enough for like two or tree words !
    this is why i want to keep my search box design, and change it mechanism into google cse, so that’s my question guy’s
    I’m really having a hard time this this thing to get solved

    #187352
    __
    Participant

    You cannot use your form. GCSE generates its own form. However, I’ve seen Google search boxes on various website with all kinds of styling applied. Have you tried simply applying the CSS for your original form to the form GCSE generates?

    #188669
    Eriaku
    Participant

    No i did not, i do not know how ..

Viewing 15 posts - 1 through 15 (of 15 total)
  • The forum ‘Other’ is closed to new topics and replies.