#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    6
    Rep Power
    0

    Programming newb


    How could I make this program faster? Any help would be appreciated.





    #10
    July 4th, 2013, 01:14 AM
    Jrcastee
    Registered User


    Join Date: Jul 2013
    Posts: 5
    Time spent in forums: 15 m 12 sec
    Reputation Power: 0
    var size_i_want = "11";
    var how_many = 1;

    function addToCart() {
    var sizesList=document.getElementsByName("skuAndSize")[0];
    function setQuantity() {
    document.getElementsByName("qty")[0].selectedIndex = how_many-1;
    }
    function setSizeValue() {
    for (var i=0; i<sizesList.length; i++){
    if(sizesList.options[i].text == size_i_want) {
    document.getElementsByName("skuAndSize")[0].selectedIndex = i;
    setQuantity();
    }
    }
    }
    if(sizesList != undefined) {
    setSizeValue();
    document.getElementsByClassName("button-container add-to-cart")[0].click();
    } else {
    setTimeout("addToCart()", 250);
    }
    }
    setTimeout("addToCart()", 250);




    i have a few problems but the first is it is too slow.
  2. #2
  3. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,534
    Rep Power
    1906
    You have mixed the forums.
    This is the Java forum, you want to look for the JavaScript forum

    Futhermore, please use code tags [code] [/code] when posting code.

IMN logo majestic logo threadwatch logo seochat tools logo