|
-
Apr 2nd, 2001, 05:12 PM
#1
I want to use a sleect option html box just liek a list box in VB. Is this possible?
What i am trying to accomlish is to have a list of things and to be able to add or delete items depending on button presses.
I dont know how to manipulate the select box this way.
this is my code so far:
<SELECT NAME="items" SIZE=5>
<OPTION>Windows</option>
<OPTION>Macintosh</option>
<OPTION>UNIX</option>
</SELECT>
and i have two buttons, one is an add button which when pressed brings up a prompt and when a user enters infor it should appear in the above select box.
the delete button shoudl casue the selected item in the above box to be elimanted.
If i can't do this in JAvaScript, any suggestons on how to do it? Thanks.
-
Apr 2nd, 2001, 09:46 PM
#2
PowerPoster
That could be really easily done if you could use ASP and a database. Can you use this technology?
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Apr 2nd, 2001, 10:06 PM
#3
not quite it must be done wiht java script since i am putting it on my desktop wiht active desktop.
I found a good solution on my own though:
http://htmlgoodies.earthweb.com/tutors/ifthis.html
check it out if anyone has this same problem
-
Apr 3rd, 2001, 03:00 AM
#4
Frenzied Member
Code:
<HTML>
<HEAD>
<script language=javascript>
function addItem()
{
var oOption;
var strTemp = prompt("Enter new item")
oOption = document.createElement("OPTION");
oOption.text=strTemp;
document.frm1.items.add(oOption);
}
function removeItem()
{
var i = document.frm1.items.selectedIndex;
document.frm1.items.options[i] = null;
}
</script>
</HEAD>
<BODY>
<form name=frm1>
<SELECT NAME="items" SIZE=5>
<OPTION>Windows</option>
<OPTION>Macintosh</option>
<OPTION>UNIX</option>
</SELECT>
<br>
<input type=button value="Add Item" onClick="addItem()">
<input type=button value="Remove Item" onClick="removeItem()">
</form>
</BODY>
</HTML>
-
Apr 3rd, 2001, 09:19 AM
#5
Frenzied Member
I'm glad you found an answer, and Mark has a good one, too.
As to the suggestion of ASP. You could use that approach if you wanted the menu to be populated server side. Since you want it dynamicaly altered on the client side, you must use a client side technology, such as JavaScript (or JScript).
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|