View Single Post
Old 01-06-2011, 08:29 AM   PM User | #2
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,032
Thanks: 197
Thanked 2,410 Times in 2,388 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
It is no more than a series of select lists from which the user may choose an option.


Code:
<select id = "list1">
<option value = "">Choose a recipient</option>
<option value = "Father">Father</option>
<option value = "Mother">Mother</option>
<option value = "Grandma">Grandma</option>
</select>

<input type = "button" value = "Generate Letter" onclick = "generate()">
<br><br>
<div id = "letter">
</div>

<script type = "text/javascript">

function generate() {
var r = document.getElementById("list1").value;
if (r!="") {
var message = "Dear " + r + ",";
document.getElementById("letter").innerHTML = message;
}
}
</script>
All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.
Philip M is offline   Reply With Quote
Users who have thanked Philip M for this post:
theatomicdude (02-16-2011)