:wave: 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..
Printable View
:wave: 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..
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>