Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Script running slow on IE

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #37297
    Schmotty
    Participant

    I need some help to make this more efficient. I have built a page that allows salesmen to send product pictures via email to their clients. This includes a group shot and individual images of each color or each product. For a total of 507 images on the one page. I have a checkbox for each.

    All browsers handle everything just fine, but IE 8- runs slow and gives an error when the page is submitted to send the mail. The mail still sends and everything works, but the “slow script” error gives the salesmen the fear that something is broken.

    Is there a way I can make this more efficient?

    Here are my relevant scripts:


    var selected = 0;
    var beenAbove = false;
    function isOneSelected(yesno){

    if(yesno.checked){
    selected++;
    } else {
    selected--;
    }

    document.getElementById('sel').innerHTML=" "+selected;
    var cpics;

    if(selected>10){
    yesno.checked=false;
    alert('You have too many pictures selected. Maximum is 10.');
    }else if(selected==10){
    cpics = document.getElementsByName('pictures[]');
    beenAbove = true;
    var i;
    for(i=0; i if(cpics.checked==false){
    cpics
    .disabled=true;
    }
    }
    } else {
    if (beenAbove==true){
    for(i=0; i cpics
    .disabled=false;
    }
    beenAbove = false;
    }
    }
    }
    function clearAll(){
    var cpics = document.getElementsByName('pictures[]');
    var i;
    for(i=0; i cpics
    .checked=false;
    cpics
    .disabled=false;
    }
    selected=0;
    document.getElementById('sel').innerHTML=" "+selected;
    cpics = 0;
    }

    Relevant HTML:

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.