PDA

View Full Version : Change Value when clicking on option



[Nicolas]
12-20-2010, 01:30 AM
Hey. I would like to change a value of a text box when clicking on an option in a select tag. I would like to do this in JavaScript. Here's the code to the page:

<html>
<head>
<title>Send SMS or MMS online</title>
<script language="javascript" type="text/javascript">
function limitText(limitField, limitCount, limitNum) {
if (limitField.value.length > limitNum) {
limitField.value = limitField.value.substring(0, limitNum);
} else {
limitCount.value = limitNum - limitField.value.length;
}
}
</script>
</head>
<body>
<form name="myform">
<textarea name="limitedtextarea" onKeyDown="limitText(this.form.limitedtextarea,this.form.countdown,160);"
onKeyUp="limitText(this.form.limitedtextarea,this.form.countdown,160);">
</textarea><br>
<font size="1">(Maximum characters: 160)<br>
You have <input readonly type="text" name="countdown" size="3" value="100"> characters left.</font>
</form>
</body>
</html>
This is for an SMS website, as I will use SMTP to send, but to retrieve I'll look into... Back on topic; When clicking on an option I need it to change a text box with the carrier, like if it has a carrier from AT&T, then to change it to the carrier T-Mobile with a click. How is this possible with JavaScript? Any help appreciated... Thanks! God Bless You and Happy Holidays!