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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    2
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Help with writing text into textareas

    hey guys,
    im trying to write whether player 1 or 2 won into the text area.
    see code below.
    thanks

    [CODE]
    <html>
    <head>
    <script type="text/javascript">
    var a=1

    </script>
    <style type="text/css">
    body
    {
    background-image: url(http://fc08.deviantart.com/fs40/i/2009/018/f/8/FLOWJOB_3d_graffiti_by_UrbanCalligraphism.jpg);
    }
    h1
    {
    font-family:"sans-serif",tahoma;
    background-repeat: no-repeat;
    color:#00ffe7;
    }
    p
    {
    color:#000000;
    font-family:"sans-serif",tahoma;
    font-weight:900;
    }
    </style>
    </head>
    <body>
    <center><h1>Ghetto Dice Project</h1></center>
    </br>
    </br>
    </br>
    </br>
    </br>
    </br>
    <center>
    <textarea rows="9" cols="18" id="textarea">
    </textarea>
    </center>
    </br>
    </br>
    </br>
    </br>
    </br>
    <center>
    <table>
    <tr>
    <input type="text" id="playerone" size="4" value="">
    <input type="text" id="playertwo" size="4" value="">
    </tr>
    </br>
    <tr>
    <button onclick="
    a=(Math.floor(Math.random()*13));
    document.getElementById('playerone').value=a;
    ">
    PLAYA 1
    </button>
    <button onclick="
    b=(Math.floor(Math.random()*13));
    document.getElementById('playertwo').value=b;
    ">
    PLAYA 2
    </button>
    </tr>
    </table>
    </script>
    </br>
    </br>
    <p>
    Hand coded with care by Tanner Beck
    </p>
    </center>
    </body>
    </html>
    [CODE]

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,620
    Thanks
    78
    Thanked 4,388 Times in 4,353 Posts
    (1) See rule 1.5 of this forum.

    (2) Ummm...since when can you roll a ZERO when you toss a pair of dice? Hmmm...maybe when the guy with the big knife catches you cheating?

    (3) You don't specify *WHEN* the winner's name/whatever should appear.

    (4) Why would you need 9 ROWS in a textarea to write one winner's name/whatever??

    (5) HINT: You set the value of a <textarea> the same way you set the value of an <input type="text">.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    tannerbeck50 (11-18-2010)


  •  

    Tags for this Thread

    Posting Permissions

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