473,503 Members | 7,578 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help me in this issue

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
Jul 31 '08 #1
2 1080
On 31 Jul, 12:15, venky_lb <lb.ve...@gmail.comwrote:
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!
Jul 31 '08 #2
venky_lb wrote:
Hi,
im new to javascript ,
You may also be new to usenet. Try a newsgroup with "javascript" in it's
it's name. Like: comp.lang.javascript . Your question is off topic here
in comp.lang.php. And asking OT questions has consequences that can be
easily avoided but posting in the appropriate group.

Jeff
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
Jul 31 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2647
by: Ben | last post by:
The page below isn't picking up details or location. What have I missed? Thanks in advance, Ben ____________________________________________ <?PHP
3
2692
by: Abhas | last post by:
> > Hi, this is Abhas, > > I had made a video library program in C++, but was facing a problem. > > After entering 12 movies, i cannot enter any more movies. > > Something gibberish comes instead....
3
5485
by: Phil IU Guy | last post by:
I am having 2 issues, both acting very randomly, and for the most part I dont get this message on most computers, but I have had a couple computers get either issue 1, or issue 2. Issue #1: I...
5
1061
by: Tom Joseph | last post by:
Hi all... I am Tom. I am new to this community of asp.net enthusiasts. At this point of time, I am in trouble. I am facing an issue. I am sending you this issue in the belief that you would...
15
2063
by: DavidS | last post by:
Have Visual Studio.NET installed on MS 2000 Professional OS laptop. No issue ever with web development and SQL connections. Purchased new laptop with XP Professional SP2!!!!!!!! & Visual...
3
1265
by: Richard Bell | last post by:
I'm working on a VB application that must run 24x7 for a LONG time, think 60 days of so. As part of what it does it must automate an instance of IE and navigate to many different URLs, think many...
7
1768
by: rn5a | last post by:
This is the second time I am asking this question in this newsgroup since I haven't got a solution or response from anyone in my previous post & I need to resolve this issue desperately. Sorry for...
1
2310
by: AlmasKhan01 | last post by:
Hi I have been for sometime now been working on a MineSweeper program and I'm 90% complete on it it involves a window interface and is quite simple but the issue is not. The program is long(to me)...
1
1264
by: jkincaid | last post by:
I need help on a simple database, I have limited ACCESS skills. Here's my dilemma: I have 2 tables: Table one is customer issues Table two is the particular customer Table one includes:...
53
8315
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
0
7194
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7316
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5566
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4993
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3148
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
372
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.