#1
  1. No Profile Picture
    Unjiggy Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2001
    Location
    SOCAL
    Posts
    4
    Rep Power
    0

    JavaScript Set Focus and Reset Value


    Ok, im new to javascript, so bear with me.

    i have a form submitting to a seperate frame.

    everything is working fine, but what i want to do is:

    unset the users value in the text box.

    and

    the set the focus in the text box. so the user can type again.

    all i have is a textbox and the user pushes enter to submit the form.

    it's a chat thing.

    so if you could help that would be great.

    ian
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2002
    Posts
    3
    Rep Power
    0
    Ok..

    In the text box you could have :
    <input type="text" onFocus="this.value=''">


    And then if the page reloads, in the body tag have
    onLoad="document.FormName.TextBoxName.focus()"

    or in the <form> tag:
    onSubmit="document.Form.TextBox.focus()"

    Hope this helps
  4. #3
  5. No Profile Picture
    Unjiggy Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2001
    Location
    SOCAL
    Posts
    4
    Rep Power
    0

    almost


    well, here is my problem, the page with the form on it doesnt get reloaded. and if i do an onSubmit='reset()' then it erases the value before it subits the form and the data is lost.

IMN logo majestic logo threadwatch logo seochat tools logo