IE6 javascript error

Discussion in 'HTML & Website Design' started by trafford, Feb 8, 2010.

  1. #1
    hi guys.

    I used JavaScript based tab navigation in this page which is working properly in every browser including IE8, except IE6 which is giving error "object expected on line1". Could you please point out the problem what causing this error. The URL is given below

    clarysolar.com/HTML/residential-solar.html

    I am using this JavaScript file on that page
    ResidentialTabNavi.js

    Thanks in advance.

    Traford
     
    trafford, Feb 8, 2010 IP
  2. trafford

    trafford Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This is the code that i am using

    var ids=new Array('whySolar','HowWorks','waltSmith','clientStories');
    
    function switchid(id){	
    	hideallids();
    	showdiv(id);
    }
    
    function hideallids(){
    	//loop through the array and hide each element by id
    	for (var i=0;i<ids.length;i++){
    		hidediv(ids[i]);
    	}		  
    }
    
    function hidediv(id) {
    	//safe function to hide an element with a specified id
    	if (document.getElementById) { // DOM3 = IE5, NS6
    		document.getElementById(id).style.display = 'none';
    	}
    	else {
    		if (document.layers) { // Netscape 4
    			document.id.display = 'none';
    		}
    		else { // IE 4
    			document.all.id.style.display = 'none';
    		}
    	}
    }
    
    function showdiv(id) {
    	//safe function to show an element with a specified id
    		  
    	if (document.getElementById) { // DOM3 = IE5, NS6
    		document.getElementById(id).style.display = 'block';
    	}
    	else {
    		if (document.layers) { // Netscape 4
    			document.id.display = 'block';
    		}
    		else { // IE 4
    			document.all.id.style.display = 'block';
    		}
    	}
    }
    
    Code (markup):
     
    trafford, Feb 8, 2010 IP
  3. harrierdh

    harrierdh Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    trafford,
    Kindly post your html too. There is not enough information here to try and duplicate your problem.
     
    harrierdh, Feb 8, 2010 IP
  4. BadBoyzStudioZ

    BadBoyzStudioZ Peon

    Messages:
    760
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    0
    #4
    The issue is IE6. Period. The second issue is Javascript. Mix the two and you have some serious issues. You either spend a hundred hours pulling your hair out, or ditch the script. IE6 is still used by so many people it is unbelievable.

    You may never find a satisfactory solution. The only way to really know is to research the coder who wrote the script and see if they have any workarounds.
     
    BadBoyzStudioZ, Feb 8, 2010 IP