Results 1 to 5 of 5

Thread: Difficult....!!??

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343
    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

  2. #2
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    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!

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343

    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

  4. #4
    Fanatic Member Ianpbaker's Avatar
    Join Date
    Mar 2000
    Location
    Hastings
    Posts
    696
    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!

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    343
    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
  •  



Click Here to Expand Forum to Full Width