Re: help me in this issue
- From: Captain Paralytic <paul_lautman@xxxxxxxxx>
- Date: Thu, 31 Jul 2008 04:30:26 -0700 (PDT)
On 31 Jul, 12:15, venky_lb <lb.ve...@xxxxxxxxx> wrote:
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
This group is about php (the clue is in the name comp.lang.php).
Believe it or not, javascript questions get asked in groups with
javascript in the name.
Also, you have actually sytated any problem, all you have said is that
part of it works fine!
.
- References:
- help me in this issue
- From: venky_lb
- help me in this issue
- Prev by Date: help me in this issue
- Next by Date: Re: Open word file using php in linux server
- Previous by thread: help me in this issue
- Next by thread: Re: help me in this issue
- Index(es):