|
-
Oct 31st, 2003, 03:09 PM
#1
Thread Starter
Fanatic Member
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..
-
Oct 31st, 2003, 05:22 PM
#2
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|