SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Aug 2003
    Location
    USA
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Troubles in SearchLand

    Ok so my site layout is perfect and I am adding of all my content and everything is going fine...but THEN. (I knew you all were waiting for the big BUT)
    I have two tables right next to each other and one contains a form with a text box the other contains the graphic I want users to click to utilize the search. The question is...how do I go about making the graphic work when I CANNOT (TRIED NOT POSSIBLE UNLESS I REDESIGN MY SITE COMPLETELY) have the graphic included in the same form? Its been driving me nuts for a while now and I really need some closure on this. Also do you know of any good extremely search javascripts to use? At this point I just want something simple. Thanks in advance!

  2. #2
    Under Construction Poop_Shoot's Avatar
    Join Date
    Jul 2003
    Location
    Sacramento, CA
    Posts
    330
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I dont know about anyone else but I am confused! Could you give us a link or example code maybe! Maybe you could elaborate just a little more on the subject about the graphics! As for the search what is the search going to do?

    Jon

  3. #3
    SitePoint Enthusiast kgish's Avatar
    Join Date
    Dec 2001
    Location
    Gouda, The Netherlands
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually, there are two ways to accomplishing this.

    First of all, for DOM-compliant browsers you might consider the following:
    Code:
    <form ... id="form1">
    ...
    </form>
    <img ... onclick="document.getElementById('form1').submit()">
    For the other browsers, consider this:
    Code:
    <form ... name="form1">
    </form>
    <img ... onclick="document.form1.submit()">
    Or a more elegant solution would be to use an intervening submit function to take care of this browser "sniffing" for you:
    Code:
    <form ... id="form1" name="form1">
    </form>
    <img src="" onclick="handleSubmit('form1')">
    Where the function to handle the submit event looks something like this:
    Code:
    function handleSubmit(frm) {
      if (document.getElementById) {
    	document.getElementById(frm).submit();
      } else {
    	document.frm.submit();
      }
    }
    Hope this helps!
    Kiffin
    Your average future-famous kind of guy...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •