Make code work on IE without validation

Discussion in 'JavaScript' started by maplewood, Feb 4, 2012.

  1. #1
    This code is not validated.
    it is ok.
    it works on chrome
    But I need to make it work on IE and I don't know how.

    can you please help me?


    
    
    
    
    
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="content-type" content="text/html; charset=utf-8" />            <script language="JavaScript">function setVisibility_picBtn(id,btnid,theid) {    if(document.getElementById(theid).value=='hide_pic.jpg')    {        document.getElementById(btnid).src = 'http://www.netoglobe.com/SiteImages/gallery_4_img34.jpg';        document.getElementById(id).style.display = 'none';        document.getElementById(theid).value='show_pic.jpg'    }    else    {        document.getElementById(btnid).src = 'http://www.netoglobe.com/SiteImages/gallery_4_img39.jpg';        document.getElementById(id).style.display = 'inline';        document.getElementById(theid).value='hide_pic.jpg'    }}function setVisibility_picBtn2(number){    //alert ('input'+number);        //var mytext = "Hello again";    //document.write(mytext);    if(document.getElementById('input'+number).value=='hide_pic.jpg')    {                document.getElementById('img'+number).src = 'http://www.netoglobe.com/SiteImages/gallery_4_img34.jpg';        document.getElementById('div'+number).style.display = 'none';        document.getElementById('input'+number).value='show_pic.jpg'    }    else    {        document.getElementById('img'+number).src = 'http://www.netoglobe.com/SiteImages/gallery_4_img39.jpg';        document.getElementById('div'+number).style.display = 'inline';        document.getElementById('input'+number).value='hide_pic.jpg'    }}function setVars(number){    var textvar="";    for (i=1;i<=number;i=i+1)    {        textvar=textvar+"<li style=\"direction: rtl;\"><u id=\"u"+i+"\">X</u>&nbsp;<input type=\"hidden\" id=\"input"+i+"\" value=\"show_pic.jpg\"><img src=\"http://www.netoglobe.com/SiteImages/gallery_4_img34.jpg\" id=\"img"+i+"\" onclick=\"setVisibility_picBtn2("+i+");\"><br><div id=\"div"+i+"\" style=\"display:none;position:absolut;left:20px;top:100px;background-color:yellow;\"><table width=400 bgcolor=lightsteelblue><tr><td><table bgcolor=white width=400><tr><td id=\"td"+i+"\">Y</td></tr></table></td></tr></table><br></div></li>";    }    alert (textvar);        document.getElementById("mainparagraph").innerHTML=textvar;}function setTextToVar(number,headline,entiretext){        document.getElementById('u'+number).innerHTML=headline;    document.getElementById('td'+number).innerHTML=entiretext;}</script></head><body >                            <p id='mainparagraph'>1</p><script type='text/javascript'>setVars(20);setTextToVar(1,'heading one','text1');setTextToVar(2,'heading 2','text2.');setTextToVar(3,'head3','text3');setTextToVar(4,'h4','text4');</script>                                                </body> [LEFT][COLOR=#000000]</html>
    [/COLOR][/LEFT]
    
    
    
    Code (markup):
     
    maplewood, Feb 4, 2012 IP
  2. JohnnySchultz

    JohnnySchultz Peon

    Messages:
    277
    Likes Received:
    4
    Best Answers:
    7
    Trophy Points:
    0
    #2
    does it return 1?

    works on my ie..
     
    JohnnySchultz, Feb 6, 2012 IP
  3. maplewood

    maplewood Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    On ie it returns 1 yes
    but it shouldn't
    on chrome it is doing what it should
     
    maplewood, Feb 7, 2012 IP
  4. JohnnySchultz

    JohnnySchultz Peon

    Messages:
    277
    Likes Received:
    4
    Best Answers:
    7
    Trophy Points:
    0
    #4
    ok.. upon checking your code..

    1. does you script really have to be in one line? from the looks of it, you have it in one line and i saw some commented lines (//)
    2. correct me if im wrong, you don't need //<![CDATA[ and //]]> you can remove them. i have experienced this before, it caused the script not to work in IE..
     
    JohnnySchultz, Feb 9, 2012 IP