Results 1 to 2 of 2

Thread: changing the value

  1. #1

    Thread Starter
    Fanatic Member merhaba's Avatar
    Join Date
    Sep 2002
    Location
    Istanbul,Bartin-Gallipoli(Gelibolu-Canakkale)
    Posts
    601

    changing the value

    hi there,
    Please help me with the following easy questions.
    1.I want to change the "value" of a "button" by using "prompt"
    2.I want my "text" which I wrote in textbox1 move to textbox2 after clicking a button..
    thanks..

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    Here you go:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Answering simple qs. for Merhaba</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript">
    function chVal() {
    var new_value = prompt("Insert the value you want on the button","Insert the wanted value here")
    document.getElementById('MyButton').value = new_value
    }
    function copy_txt(from,to) {
    document.getElementById(to).value = document.getElementById(from).value
    }
    </script>
    </head>
    
    <body>
    <input type="button" value="bring up prompt to change button below" onClick="chVal()"><br>
    <input type="button" value="Original Value" id="MyButton"><br>
    <br>
    <br>
    This button will copy the contents of the 1st textfield into the 2nd textfield<br>
    <input type="button" value="Original Value" onClick="copy_txt('firstTXT','secondTXT')">
    <br>
    <input name="firstTXT" type="text" value="This is the Value">
    <input name="secondTXT" type="text" value="">
    </body>
    </html>

Posting Permissions

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



Click Here to Expand Forum to Full Width