Jump to content
Sign in to follow this  
Gben

html question

Recommended Posts

I'm playing with google custom search, trying to create one. I found this helpful script which I understand how to customise so that google will search:

  • all of google
  • or just website #1
  • or just website #2
<form method="get" action="http://www.google.com/search">

 <div style="border:1px solid black;padding:4px;width:20em;">
 <table border="0" cellpadding="0">
 <trtd>
 <input type="text"   name="q" size="25"
  maxlength="255" value="" />
 <input type="submit" value="Google Search" /></td/tr>
 <trtd align="center" style="font-size:75%">
 <input type="checkbox"  name="sitesearch"
  value="website #1" checked /> only search website #1<br />
 <input type="checkbox"  name="sitesearch"
  value="website #2" checked /> only search website #2<br />

 </form>

 

But how do I change the script so that it searches:

  • all of google
  • or just website #1
  • or just website #2
  • both website #1 and website #2 but not the rest of google
I tried just adding multiple sites to the value line, but it doesn't work. How should it be done?

 

<input type="checkbox"  name="sitesearch"
    value="website #1, website #2" checked /> search website #1 & #2 only<br />

Share this post


Link to post

You cannot comma separate values like that. You would have to pass a new search string to search both sites instead of one at a time.

Share this post


Link to post
hmm... you may need JavaScript for that. Why do you need to pass multiple sites, anyway?

 

Think in terms of searching just "Dell Australia" first, and/or "All DELL sites" (US, ASIA etc).

Share this post


Link to post

If you just pass the form information as a post to Google using its search form, you could easily pass the necessary query. Though... not sure how custom it would actually be.

 

Maybe you should look this one up. I'm not too fluent on Google's custom search API...

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×