SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    value of textbox

    I've got a textbox (within a form) which is blank.

    How can I program a button that will make a value appear in the textbox without refreshing the page??


    Salvo

  2. #2
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Location
    Birmingham, UK
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    reply

    you dont have to use asp for this, its a simple JavaScript.

    :code:
    <Script language="JavaScript">
    function inputValue(){
    var text = "hello world"
    document.form.textname.value = text
    }
    </Script>
    <input type="button" value="click me" onClick="inputValue()">

    its as simple as that

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2002
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thx Phil

    I've translated your code into asp as:

    response.write("<INPUT TYPE='button' NAME='button1' VALUE='Click Me' onClick=formname.textboxname.value='" & var & "'>")


    Salvo


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
  •