help me in this issue
- From: venky_lb <lb.venky@xxxxxxxxx>
- Date: Thu, 31 Jul 2008 04:15:03 -0700 (PDT)
Hi,
im new to javascript ,here im trying to select an category from
select option ,and that category must display on other select option
2. remove is working fine
pls assist
<script type="text/javascript">
function addOptions(selcat,selmc)
{
var sel=document.getElementById(selcat);
var val=document.getElementById(selmc);
if (val.length==0) return;
for (var i=0;i<zxcsel.options.length;i++){
if (sel.options[i].text== val) return;
}
sel.options[sel.options.length]=new Option(val,'',true,true);
sel.selectedIndex=0;
}
function removeOptions(selectbox)
{
var i;
for(i=selectbox.options.length-1;i>=0;i--) {
if(selectbox.options[i].selected)
selectbox.remove(i);
}
}
</script>
<input type="text" name="category" id="category" value="" size="30" /
//place where i select categories<input type="button" name="in_add" id="in_add" class="btn_yellow"
value="Add" onclick="addOptions('category','multiselect')";/>
<select name="sel_category" id="multiselect" multiple="multiple"
size="5"> //the selected categories should
<option value="">Automotive Parts</option>
<option value="">Cars</option>
<option value="">Computers</option>
<option value="">Electronics</option>
<option value="">Equipments</option>
<option value="">Rental Property</option>
<option value="">Tickets</option>
</select>
<input type="button" name="in_remove" id="in_submit"
class="btn_yellow" value="Remove"
onClick="removeOptions(multiselect)";/>
Thanks
.
- Follow-Ups:
- Re: help me in this issue
- From: Jeff
- Re: help me in this issue
- From: Captain Paralytic
- Re: help me in this issue
- Prev by Date: Re: Header Processing
- Next by Date: Re: help me in this issue
- Previous by thread: Header Processing
- Next by thread: Re: help me in this issue
- Index(es):