|
-
Apr 11th, 2001, 02:33 AM
#1
Thread Starter
Hyperactive Member
Hello,
I think this is a tricky one...
I have a dropdown menu which is filled with products read from my db at
startup. So when the page first opens, the dropdown is filled with
+- 300 different products. I now want the user to be able to
either double click/click on a item OR highlight the item and then click on
another button which will then move/display that selected item in a
scrolling textbox WITHOUT having to refresh the screen - so I assume it
will have to be client-side script!!
This whole procedure will in other words work something like MS Outlook....
when you compose a new message, click on "TO", you can double click on
the items in your address book which then moves that item to the "Message Recipients" textbox.
Any help, tips, suggestions will be very much appreciated.
Thanks,
T
-
Apr 11th, 2001, 02:46 AM
#2
Fanatic Member
Hi again turfbult
wack this code into a html page and it will do what you ask
<HTML>
<HEAD>
<SCRIPT language="Javascript">
function MoveItem()
{
document.Test.TextBox.value = document.Test.ListBox.options[document.Test.ListBox.selectedIndex].value;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name="Test">
<SELECT Name="ListBox">
<OPTION value="Hello">Hello</OPTION>
<OPTION value="World">World</OPTION>
</SELECT>
<INPUT type="Text" Name="TextBox">
<INPUT type="Button" onclick="MoveItem();" value="Follow the white rabbit">
</FORM>
</BODY>
</HTML>
Hope it helps
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Apr 11th, 2001, 02:54 AM
#3
Thread Starter
Hyperactive Member
You're the man...
Hey Ian,
Thanks for this, I thought it was difficult - obviously not!!
Just one more thing....
How can I change this code to display EVERYTHING, one after the other which I selected.
Ie. I select "hello", click button, select "world", click button, click "hello" again, click button
The result in the text area being...
hello
world
hello
Thanks,
T
-
Apr 11th, 2001, 03:01 AM
#4
Fanatic Member
If you change the javascript function to this
function MoveItem()
{
var textValue;
textValue = document.Test.TextBox.value;
textValue = textValue + ' ' + document.Test.ListBox.options[document.Test.ListBox.selectedIndex].value;
document.Test.TextBox.value = textValue;
}
it will do it 
Ian
Yeah, well I'm gonna build my own lunar space lander! With blackjack aaaaannd Hookers! Actually, forget the space lander, and the blackjack. Ahhhh forget the whole thing!
-
Apr 11th, 2001, 03:04 AM
#5
Thread Starter
Hyperactive Member
Thank you very much Ian,
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
|