Hiding selected divs with by keyword

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jarrodprice
    New Member
    • Nov 2006
    • 1

    Hiding selected divs with by keyword

    If I had 4 divs, box1, box2, box3 and box4, and I wanted a script to make certain combinations of them visable controlled by a number sequence in a second div called: "1to4".

    The script should be conditional: when the contents of div "1to4" are "124", <div box1, box2, and box4 automatically show. If the contents of "1to4" are "1234", then all 4 divs should be displayed. The contents of "1to4" start as a custom tag called {{LAYOUT}}, which is filled in automatically by my server for each inventory item.
    Here is the existing code.




    The solution I had used the following script:

    script language="javas cript">
    [CODE=javascript] function showHide(){
    var pDivArr=documen t.getElementByI d('1to4').inner HTML.split("");
    var fDiv="box";
    for(i=0;i<pDivA rr.length;i++){
    var divN=fDiv+pDivA rr[i];
    if(document.get ElementById(div N)){
    document.getEle mentById(divN). style.display=" block";
    }
    }
    }
    [/CODE] </script>

    This worked perfectly, until I tried to post to ebay. Ebay prevents this particular script from working.

    I am hoping to find a variation on the same script that ebay will allow.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Perhaps ebay doesn't allow any script.

    The code posted is OK, except that IDs should not start with a number, so "1to4" should be replaced with, e.g. "OneTo4".

    Comment

    Working...