Dynamic Value in middle of object reference

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • D Mineer

    #1

    Dynamic Value in middle of object reference

    HEre is my code

    function passVal(p,q,r){
    with (window.opener. form1) {
    bldr_cmpny.valu e=p
    bldr_cotel.valu e=q;
    bldr_lcse.value =r;
    }
    window.close();
    }

    Works great, however, due to bad database design we have 3 differenct
    sections of a record and the only difference is instead of "bldr" it is
    prefixed with "ownr".

    So based on another passed value, lets say "w" I want to indicate a dynamic
    value.

    I tried eval("window.op ener.form1."+w+ "_company.value ") and I get the right
    info when testing in an alert popup, but it doesnt evaluate correctly like
    above.

    TIA,

    Dave


  • kaeli

    #2
    Re: Dynamic Value in middle of object reference

    In article <TRBgb.34$e86.4 4545@news.uswes t.net>, davemineer@msn. com
    enlightened us with...
    [color=blue]
    > Works great, however, due to bad database design we have 3 differenct
    > sections of a record and the only difference is instead of "bldr" it is
    > prefixed with "ownr".
    >
    > So based on another passed value, lets say "w" I want to indicate a dynamic
    > value.
    >[/color]

    function passVal(p,q,r,w )
    {
    // w is either "bldr" or "ownr"
    var f = window.opener.f orm1;
    f.elements[w+"_cmpny"].value=p;
    f.elements[w+"_cotel"].value=q;
    f.elements[w+"_lcse"].value=r;
    window.close();
    }

    -------------------------------------------------
    ~kaeli~
    Jesus saves, Allah protects, and Cthulhu
    thinks you'd make a nice sandwich.


    -------------------------------------------------

    Comment

    Working...