Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2006
    Thanked 0 Times in 0 Posts

    textbox / listbox relationship function problem

    var objListBox = document.getElementById('catalist');
    var val = objListBox[objListBox.selectedIndex].value;
    var txt = dyevalue00.value;
    document.getElementById(val).value = txt;
    Now I'm very new at this, and I've done much research to try to find this answered and could not. So let me explain in detail what I'm trying to do, maybe someone could shed light on the situation?

    To explain real quick, this is for a character maker.
    The "catalist" is a listbox with different values such as "Body1" -
    "Head" - "Shoes" - "Hair" etc
    "dyevalue00" is a textbox id.
    I have many textboxes that are named the same as the "catalist" values
    (like textboxes named Body1 - Head - Shoes - Hair - etc..

    So if the selected value on CataList is "hair", then I want the textbox that has the id of "hair" to equal whatever is inside the textbox with the id of

    I must be doing something wrong in my code, since this isn't working. =(
    I was thinking possibly if, else if statements would work but I can't seem to figure that out either. The site currently only works in firefox (I know ) but the link is www.cnex.us/sandbox/demo.html if you want to see kinda the layout to get an understanding. Thanks again guys =)

    edit: A better way to describe this in simple terms would be that I need a way to make it so that if listbox1.value="text1" then I can make the textbox named "text1" equal another textbox.value
    Last edited by Nagnag; 09-03-2006 at 02:43 PM.

  • #2
    Senior Coder
    Join Date
    Mar 2005
    Portsmouth UK
    Thanked 513 Times in 500 Posts
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    <script language="JavaScript" type="text/javascript">
    function Cng(obj,tb){
    <input name="TB1" value="1234" ><br>
    <select onchange="Cng(this,'TB1');" >
    <option value="Tom" >Tom</option>
    <option value="Dick" >Dick</option>
    <option value="Harry" >Harry</option>
    <input name="Tom" ><br>
    <input name="Dick" ><br>
    <input name="Harry" ><br>

    God Loves You and will never love you less.


    If my post has been useful please donate to http://www.operationsmile.org.uk/

  • #3
    New to the CF scene
    Join Date
    Sep 2006
    Thanked 0 Times in 0 Posts
    Thanks very much! I need someone like you that speaks js fluently to help me with my site, haha :P
    Last edited by Nagnag; 09-04-2006 at 01:00 PM.


    Posting Permissions

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