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
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, Kindly post your html too. There is not enough information here to try and duplicate your problem.
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.