passing variable to argument in method

Discussion in 'JavaScript' started by gvm, Oct 17, 2006.

  1. #1
    function shirtSize(){
    var sml = 'small';
    location="JavaScript:top.HIDDEN.addtoCart('shirt, T + sml', 6.00)";
    }

    As is, the return shows: shirt, T sml, $6.00.
    I want the return to show: shirt, T small, $6.00.

    I'm not sure what to do here...thanks for any help.
     
    gvm, Oct 17, 2006 IP
  2. gvm

    gvm Guest

    Messages:
    39
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Changing this line:
    location="javascript:top.HIDDEN.addtoCart('shirt, T + sml', 6.00)";

    to this line solved the problem,
    location="javascript:top.HIDDEN.addtoCart('shirt, T "+sml+"', 6.00)";
     
    gvm, Oct 17, 2006 IP