Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Sep 2012
    Posts
    79
    Thanks
    2
    Thanked 1 Time in 1 Post

    ie incompatibility

    Could you please identify, why this piece doesn't work with internet explorer6
    while it works in chrome, firefox and opera?
    ey

    Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    
    
    <body onLoad="ST()" >
    <center>
      <table  border="0">
        <tbody>
          <tr>
            <td><form name="item">
                <pre>&nbsp;</pre>
                <table border="0" cellspacing="0" cellpadding="0"
    width=1000px>
                  <tr>
                    <td height="89">&nbsp;</td>
                  </tr>
                  <tr>
                    <td height="82"><p>toy
                      <input type="TEXT" name="a" size="20" value=""
    id="okno">
                      </p>
                      <p> 
                        <input type="button" value=" UP " 
                  
                  onClick="dawaj()">
                        <input type="button" value=" DOWN " 
                  
                  onClick="dawaj2()">
                    </p></td>
                  </tr>
                  <tr>
                    <td height="78">&nbsp;</td>
                  </tr>
                </table>
                <center>
                </center>
              </form>
              
        </tbody>
      </table>
    </center>
    <script> 
    n=1;
    
    function
    SH(v){zz=v.length;for(i=1;i<(zz);i++){y=r(zz);x=r(zz);z=v[y];v[y]=v[x];v[x
    ]=z}}
    function ST(){SH(item);b=item.length;}
    
    function dawaj(){
    n=n+1; if (n>b-1){n=1}
    if(item[n]==null){n=0};x=item[n];v=new 
    Array;x=x+"|";i=0;while(x.length>1){l=x.substring(0,x.indexOf("|"));v[i]=l
    ;i++;x=x.substring(x.ind
    exOf("|")+1)};
    
    document.item.a.value=v[0]; 
    }
    
    function dawaj2(){
    //
    n=n-1;if (n<1){n=b-1}	
    if(item[n]==null){n=0};x=item[n];v=new 
    Array;x=x+"|";i=0;while(x.length>1){l=x.substring(0,x.indexOf("|"));v[i]=l
    ;i++;x=x.substring(x.ind
    exOf("|")+1)};
    
    document.item.a.value=v[0]; 
    }
    
    
    function r(){}
    
    
    item=new Array("",
    "boy|strong|brave",
    "girl|pretty|smart",
    "dog|furry|friendly"
    );
    
    </script>
    </body>
    </html>

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,664
    Thanks
    80
    Thanked 4,641 Times in 4,603 Posts
    You really CARE about IE6???

    Most of us have about given up on even IE7, since it is so old. IE6 is really getting ancient.

    However...

    It just MIGHT help if you told us WHAT doesn't work.

    As it is, we have no way of knowing, since most of us no longer have IE6 to test it with.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    The code as posted is full of illegal line breaks, and so won't run anywhere.
    Once formatted you'll see that the IE error console indicates 'object doesn't support this action'.
    It soon becomes clear that it doesn't like the reference to item, which in I.E. is a global object. Call it something else.

  • #4
    New Coder
    Join Date
    Sep 2012
    Posts
    79
    Thanks
    2
    Thanked 1 Time in 1 Post
    Yes, these sure are valid points. It appears my ie is 7 (so also dated) but the point is that I am facing problems with making an app names siteinfile transform my page into an exe. I instantly connected it with the errors in ie, which do not manifest themselves in chrome, firefox adn opera, admittedly, newer.

    Here's the code without the line breaks, and "item" changed to "Sache".


    I may gave undertaken a wrong approach in assuming that seasoned js coders would catch any flaws in the code like this, and this is what my question is about: is the JS piece of code written properly?

    While in chrome the buttons switch between three kinds of toys, in ie7 they take no effect - nothing shows up.


    Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    
    
    <body onLoad="ST()" >
    <center>
      <table  border="0">
        <tbody>
          <tr>
            <td><form name="sache">
                <pre>&nbsp;</pre>
                <table border="0" cellspacing="0" cellpadding="0"
    width=1000px>
                  <tr>
                    <td height="89">&nbsp;</td>
                  </tr>
                  <tr>
                    <td height="82"><p>toy
                      <input type="TEXT" name="a" size="20" value=""
    id="okno">
                      </p>
                      <p> 
                        <input type="button" value=" UP " 
                  
                  onClick="dawaj()">
                        <input type="button" value=" DOWN " 
                  
                  onClick="dawaj2()">
                    </p></td>
                  </tr>
                  <tr>
                    <td height="78">&nbsp;</td>
                  </tr>
                </table>
                <center>
                </center>
              </form>
              
        </tbody>
      </table>
    </center>
    <script> 
    n=1;
    
    function
    SH(v){zz=v.length;for(i=1;i<(zz);i++){y=r(zz);x=r(zz);z=v[y];v[y]=v[x];v[x
    ]=z}}
    function ST(){SH(sache);b=sache.length;}
    
    function dawaj(){
    n=n+1; if (n>b-1){n=1}
    if(sache[n]==null){n=0};x=sache[n];v=new Array;x=x+"|";i=0;while(x.length>1){l=x.substring(0,x.indexOf("|"));v[i]=l
    ;i++;x=x.substring(x.indexOf("|")+1)};
    
    document.sache.a.value=v[0]; 
    }
    
    function dawaj2(){
    //
    n=n-1;if (n<1){n=b-1}	
    if(sache[n]==null){n=0};x=sache[n];v=new 
    Array;x=x+"|";i=0;while(x.length>1){l=x.substring(0,x.indexOf("|"));v[i]=l
    ;i++;x=x.substring(x.indexOf("|")+1)};
    
    document.sache.a.value=v[0]; 
    }
    
    
    function r(){}
    
    
    sache=new Array("","boy|strong|brave","girl|pretty|smart","dog|furry|friendly");
    
    </script>
    </body>
    </html>
    Last edited by eydg; 11-21-2012 at 04:21 AM.

  • #5
    Senior Coder Logic Ali's Avatar
    Join Date
    Sep 2010
    Location
    London
    Posts
    1,028
    Thanks
    0
    Thanked 207 Times in 202 Posts
    Still you ignore the error console. Rename the form element (and the references to it) to something different to any global variable.

    Proof:
    Code:
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    
    
    <body onLoad="ST()" >
    <center>
      <table  border="0">
        <tbody>
          <tr>
            <td><form name="xsache">
                <pre>&nbsp;</pre>
                <table border="0" cellspacing="0" cellpadding="0"
    width=1000px>
                  <tr>
                    <td height="89">&nbsp;</td>
                  </tr>
                  <tr>
                    <td height="82"><p>toy
                      <input type="TEXT" name="a" size="20" value=""
    id="okno">
                      </p>
                      <p> 
                        <input type="button" value=" UP " 
                  
                  onClick="dawaj()">
                        <input type="button" value=" DOWN " 
                  
                  onClick="dawaj2()">
                    </p></td>
                  </tr>
                  <tr>
                    <td height="78">&nbsp;</td>
                  </tr>
                </table>
                <center>
                </center>
              </form>
              
        </tbody>
      </table>
    </center>
    <script> 
    n=1;
    
    function
    SH(v){zz=v.length;for(i=1;i<(zz);i++){y=r(zz);x=r(zz);z=v[y];v[y]=v[x];v[x
    ]=z}}
    function ST(){SH(sache);b=sache.length;}
    
    function dawaj(){
    n=n+1; if (n>b-1){n=1}
    if(sache[n]==null){n=0};x=sache[n];v=new Array;x=x+"|";i=0;while(x.length>1){l=x.substring(0,x.indexOf("|"));v[i]=l
    ;i++;x=x.substring(x.indexOf("|")+1)};
    
    document.xsache.a.value=v[0]; 
    }
    
    function dawaj2(){
    //
    n=n-1;if (n<1){n=b-1}	
    if(sache[n]==null){n=0};x=sache[n];v=new 
    Array;x=x+"|";i=0;while(x.length>1){l=x.substring(0,x.indexOf("|"));v[i]=l
    ;i++;x=x.substring(x.indexOf("|")+1)};
    
    document.xsache.a.value=v[0]; 
    }
    
    
    function r(){}
    
    
    sache=new Array("","boy|strong|brave","girl|pretty|smart","dog|furry|friendly");
    
    </script>
    </body>
    </html>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •