Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Dec 2002
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Any Expert? please help me Out!!

    This is passing values from one ListBox to another ListBox....

    What Im trying to do is to leave the left ListBox and make the right one a Textarea, so that I could pass any of the ListBox values on to the textarea Without replacing whatever text I have already on the Textarea

    If you get this one your The Best!!!



    <html><head>
    <script language="JavaScript">


    function addSrcToDestList() {destList = window.document.forms[0].destList;srcList = window.document.forms[0].srcList; var len = destList.length;for(var i = 0; i < srcList.length; i++) {if ((srcList.options[i] != null) && (srcList.options[i].selected)) {


    var found = false;for(var count = 0; count < len; count++) {if (destList != null) {if (srcList.options[i].text == destList.text) {}}}if (found != true) {destList[len] = new Option(srcList.options[i].text);
    len++;}}}}

    </SCRIPT></head><body>

    <form method="POST">
    <select size="5" name="srcList">
    <option value="1">Item 1<option value="1">Item 2</select>
    <input type="button" value=" > " onClick="javascript:addSrcToDestList()">
    <select size="5" name="destList">
    </select>
    </form></body></html>

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    A textarea? Or another select element? Because the code you posted has another select element.

    Which is it supposed to be?
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #3
    Regular Coder
    Join Date
    Jan 2003
    Posts
    867
    Thanks
    4
    Thanked 8 Times in 8 Posts
    Is this what you're trying to do? It appends the select box value to the textarea.

    Code:
    <html>
    <body>
    <form name="myform">
    <select onchange="document.myform.my_ta.value += document.myform.my_sl[document.myform.my_sl.selectedIndex].text" name="my_sl">
    <option>1</option>
    <option>2</option>
    <option>3</option>
    <option>4</option>
    <option>5</option>
    </select>
    
    <textarea name="my_ta">my text area</textarea>
    </body>
    </html>

  • #4
    New Coder
    Join Date
    Dec 2002
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up arnyinc (Thanx, that was it!)

    thank you very much!!!!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •