Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Newbie needs help for peace of mind

    Hi there newbie here:

    Here's my code:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>

    </head>

    <body>
    <form name="form1" method="post" action="">
    <p>
    <input type="text" name="raultext">
    </p>
    <p>
    <input name="submit" type="submit" id="submit" value="1" onClick="EscribeDigito('1')">
    </p>
    </form>
    </body>
    </html>



    Quite boring yes?? well here goes my question,

    I'd like to be able to click the number 1 button and make it appear in the text field. COuld anybody please point me in the right direction?

    Thanks!

  • #2
    Regular Coder
    Join Date
    Aug 2005
    Location
    Toronto, ON, Canada
    Posts
    231
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <input type="text" id="raultext">

    Code:
    <input 
       name="submit"
       type="submit"
       id="submit"
       value="1"
       onClick="docuemnt.getElementById('raultext').value='1'; return false;"
    >
    rm -f /

  • #3
    Regular Coder
    Join Date
    Sep 2005
    Posts
    535
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ... or to go along with that...
    onClick="docuemnt.getElementById('raultext').value=document.getElementById('submit').value;return false;"
    (note the return false at the end just prevents the form from being submitted.)

    ...if you meant the image of the button, then the answer is no. The only workaround for that would be to create a <div> and use DOM to "move" the button into the div
    Last edited by Pyth007; 09-15-2005 at 04:16 PM.


  •  

    Posting Permissions

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