SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member GenLock's Avatar
    Join Date
    Dec 2000
    Location
    New Bedford, MA
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need to create a Submit button onMouseDown

    Howdy,

    I need to create a button that on a mouse down, would submit the info, and on mouse up, would clear a INPUT=text box. Anyone have a clue?

    Here's what I've got so far...

    <!--Begin NavBar Search Engine--><FORM NAME=sform ACTION=../search/site_searcher.cgi METHOD=GET TARGET="body"><TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH=125>
    <TR><TD><B>
    Search <I>RI/I></B></TD></TR><TR>
    <TD><INPUT TYPE=TEXT NAME="searchterm" SIZE=11 MAXLENGTH=100 VALUE=""><INPUT TYPE=HIDDEN NAME="Boolean" VALUE=all the words></TD><TD><INPUT TYPE=IMAGE HEIGHT="22" WIDTH="22" BORDER=0 SRC="../assets/images/gosearch.gif" VALUE=submit ALT="Search"></TD>
    </TR></TABLE></FORM><!--End NavBar Search Engine-->

    I need to be able to clear "searchterm" after the IMAGE is clicked. I am having no problems with it running right now, I just need the field to be cleared AFTER the submit. I tried putting the value on the button (onSubmit="here was the script to clear the form") but when I did that, it cleared the info BEFORE sending it. That's why I want the info sent on the mouse down, and when it goes up, clear the field, AFTER the info has already been sent. As you can see, I'm doing this in a frameset. Any help would be nice. Thanks.

    Eddie
    GenLock
    Edward A. Leonard
    WebMaster - findRI.com - Rhode Island's Online Magazine
    "Destroy Osama bin Laden, and all Terrorists A.S.A.P."

  2. #2
    SitePoint Guru Vincent Puglia's Avatar
    Join Date
    Feb 2000
    Location
    where the World once stood
    Posts
    700
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Eddie,

    although I don't know it won't have the same problem you are already aware of:

    <a href="#" onMouseDown="this.form.submit()" onMouseUp="document.sform.searchterm.value=''"><img...></a>

    another alternative:
    <a href="#" onClick="submitIT(this.form)"> img...></a>

    function submitIt(formObj)
    {
    formObj.submit();
    ... setTimeout, do while loop, alert("your form was sent"), etc...
    formObj.searchterm.value = "";
    }

    you may also be able to use Number.POSITIVE_INFINITY for the waiting code. If you are unfamiliar with the constant, see:
    http://66.34.42.140/forums/search.ph...der=descending

    Vinny
    Last edited by Vincent Puglia; Sep 5, 2001 at 18:55.
    Where the World Once Stood
    the blades of grass
    cut me still

  3. #3
    SitePoint Member GenLock's Avatar
    Join Date
    Dec 2000
    Location
    New Bedford, MA
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Thanks Vinny

    I'll give it a try and see which one works better.

    Thanks,

    Genlock
    GenLock
    Edward A. Leonard
    WebMaster - findRI.com - Rhode Island's Online Magazine
    "Destroy Osama bin Laden, and all Terrorists A.S.A.P."

  4. #4
    SitePoint Member GenLock's Avatar
    Join Date
    Dec 2000
    Location
    New Bedford, MA
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Upon further review, I've decided to go another route...

    Check my new post out, if you dare...



    GenLock
    GenLock
    Edward A. Leonard
    WebMaster - findRI.com - Rhode Island's Online Magazine
    "Destroy Osama bin Laden, and all Terrorists A.S.A.P."


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
  •