Javascript Problems on Mac's

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Big Dave

    #1

    Javascript Problems on Mac's

    Good morning. Any help anyone could provide would be much
    appreciated. I'm pulling values from a database and I need to select
    a matching option in a select box. I've got a function to do this,
    and it works fine on a pc, but not on a mac IE5. I can't find any
    information about why this wouldn't work. Here's the code:

    //Select matching option in a select box;
    function select_option(f ield_name, cur_value){
    var obj_form = document.forms[0];
    var obj_field = obj_form(field_ name);
    for(i=0; i<obj_field.len gth; i++){
    if(obj_field.op tions[i].value == cur_value){
    obj_field.optio ns[i].selected = true;
    }
    }
    }

    The function is called like this, written by asp:
    Response.Write( "<script
    language=""java script"">select _option(""mktin g_prsn" & i & """, """ &
    Session("user_i d") & """);</script>")

    which ends up being:
    <script language="javas cript">select_o ption("mkting_p rsn1",
    "878001");</script>

    Any thoughts on why this wouldn't work on a mac? Oh, and I've also
    already tried document.forms[0].mkting_prsn1.v alue = "878001", this
    didn't work either on the mac. Thanks again for any help.
  • Chris Riesbeck

    #2
    Re: Javascript Problems on Mac's

    david.wade@raym ondjames.com (Big Dave) wrote in message news:<bc773cf0. 0310310524.5a75 efb6@posting.go ogle.com>...[color=blue]
    > Good morning. Any help anyone could provide would be much
    > appreciated. I'm pulling values from a database and I need to select
    > a matching option in a select box. I've got a function to do this,
    > and it works fine on a pc, but not on a mac IE5. I can't find any
    > information about why this wouldn't work. Here's the code:
    >
    > //Select matching option in a select box;
    > function select_option(f ield_name, cur_value){
    > var obj_form = document.forms[0];
    > var obj_field = obj_form(field_ name);[/color]

    use obj_form[field_name]

    [color=blue]
    > for(i=0; i<obj_field.len gth; i++){
    > if(obj_field.op tions[i].value == cur_value){
    > obj_field.optio ns[i].selected = true;
    > }
    > }
    > }
    >
    > The function is called like this, written by asp:
    > Response.Write( "<script
    > language=""java script"">select _option(""mktin g_prsn" & i & """, """ &
    > Session("user_i d") & """);</script>")
    >
    > which ends up being:
    > <script language="javas cript">select_o ption("mkting_p rsn1",
    > "878001");</script>
    >
    > Any thoughts on why this wouldn't work on a mac? Oh, and I've also
    > already tried document.forms[0].mkting_prsn1.v alue = "878001", this
    > didn't work either on the mac. Thanks again for any help.[/color]

    Comment

    Working...