ramsharma23
asked on
How to tickmark the option in the Select box
I have select box in my application, when I will select particular option I have to tickmark (checked) that selected option. After selectiong again same option has to remove the tick mark(unchecked) the particular option.
Can you please provide me the some solution how to proceed.
Can you please provide me the some solution how to proceed.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Well, I didn't come up with much. The only concievable way to include a checkbox with your list box is to have a table cell next to your list box and have an array of checkboxes, one for each option tag. Set the value attribute of each of these checkboxes to correspond to the value of the option tag. It might work but seems a bit sloppy. Lots of processing. It would be sweet if there were an HTML character code for a checkmark. Why aren't there more of those damn things??? Anyway if you need clarification let me know. I think you could kill the border of the checkbox with the style attribute.
Good luck
JI
Good luck
JI
Here a checkbox checker:
<html>
<head>
<script>
function checkMark(theBox){
var allOpt = theBox.form[theBox.name];
for(var i=0;i<allOpt.length;i++){
allOpt[i].checked = false;
}
theBox.checked = true;
}
</script>
</head>
<body>
<form>
<input type=checkbox name="myOpt" value="A" onClick="checkMark(this)"> A<br>
<input type=checkbox name="myOpt" value="B" onClick="checkMark(this)"> B<br>
<input type=checkbox name="myOpt" value="C" onClick="checkMark(this)"> C<br>
<input type=checkbox name="myOpt" value="D" onClick="checkMark(this)"> D<br>
<input type=checkbox name="myOpt" value="E" onClick="checkMark(this)"> E<br>
<input type=checkbox name="myOpt" value="F" onClick="checkMark(this)"> F<br>
<input type=submit>
</form>
</body>
</html>
<html>
<head>
<script>
function checkMark(theBox){
var allOpt = theBox.form[theBox.name];
for(var i=0;i<allOpt.length;i++){
allOpt[i].checked = false;
}
theBox.checked = true;
}
</script>
</head>
<body>
<form>
<input type=checkbox name="myOpt" value="A" onClick="checkMark(this)">
<input type=checkbox name="myOpt" value="B" onClick="checkMark(this)">
<input type=checkbox name="myOpt" value="C" onClick="checkMark(this)">
<input type=checkbox name="myOpt" value="D" onClick="checkMark(this)">
<input type=checkbox name="myOpt" value="E" onClick="checkMark(this)">
<input type=checkbox name="myOpt" value="F" onClick="checkMark(this)">
<input type=submit>
</form>
</body>
</html>
<input type="checkbox"> Some label here