@webdev2345authorDec 12.2007 — #I have an issue with Javascript Where in if user select the first check box all the other checkbox should become disabled and the textbox below should get auto filled and this is only case with the first checkbox but not with the other.
If the user selects the other checkboxes nothing should get disabled or nothing should be filled in text box .I am populating all the values for the checkbox from the form
This is the sample code i have with me
function disable(cbx) {
//if(!cbx) return;
var frm = cbx.form;
alert
for(var i=0;i<frm.elements.length;i++) {
if (frm.elements[i].type && frm.elements[i] != cbx) {
@krishna832Feb 13.2010 — #My code is working proper way but while removeing values from second select box i didnt getting proper Sorting Order So Please Anyone Can Help To Me
<html>
<head>
<script type="text/javascript">
function sortAvailable() {
var ai = document.getElementById("availableItems");
var si = document.getElementById("selectedItems");
ai.sort();
si.sort();
}
function addItems() {
// alert("asdsd");
var ai = document.getElementById("availableItems");
var si = document.getElementById("selectedItems");
for (i=0;i<ai.options.length;i++) { if (ai.options[i].selected) { var opt = ai.options[i]; si.options[si.options.length] = new Option(opt.innerHTML, opt.value); ai.options[i] = null; i = i - 1; ai.sortAvailable() } } }
function addAll() {
var ai = document.getElementById("availableItems");
var si = document.getElementById("selectedItems");
for (i=0;i<ai.options.length;i++) {
var opt = ai.options[i];
si.options[si.options.length] = new Option(opt.innerHTML, opt.value);
}
ai.options.length = 0;
}
function removeItems() {
var ai = document.getElementById("availableItems");
var si = document.getElementById("selectedItems");
for (i=0;i<si.options.length;i++) {
if (si.options[i].selected) {
var opt = si.options[i];
ai.options[ai.options.length] = new Option(opt.innerHTML, opt.value);
si.options[i] = null; i = i - 1;
}
}
}
function removeAll() {
var ai = document.getElementById("availableItems");
var si = document.getElementById("selectedItems");
for (i=0;i<si.options.length;i++) {
var opt = si.options[i];
ai.options[ai.options.length] = new Option(opt.innerHTML, opt.value);
}
si.options.length = 0;
sortAvailable();
}
function frmSubmit() {
var si = document.getElementById("selectedItems");
for (i=0;i<si.options.length;i++) { si.options[i].selected = true; }