PDA

View Full Version : How do I?



gingerj
12-22-2005, 09:39 AM
I've got two form elements, the first is a select box with some codes say "abc", when you select ABC, it loads the product name into a textbox. How do I do it?

Iiro
12-22-2005, 10:29 AM
<html>

<head>

<title>My home page</title>

<script type="text/javascript">
function printtotextbox(what) {
box = document.yourform.textbox;
box.value=box.value + " " + what;
}
</script>
</head>

<body>
<form name="yourform">
<input type="checkbox" name="Alpha" value="abc" onclick="printtotextbox('abc')">abc<br>
<input type="checkbox" name="Alpha" value="def" onclick="printtotextbox('def')">def<br>
<input type="checkbox" name="Alpha" value="ghi" onclick="printtotextbox('ghi')">ghi<br>

<input type="text" name="textbox" value="Selected products:">
</body>
</html>

That should work.