Javascript tab navigation IE6 problem

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

waiting for the reply. Can any one solve this problem.

I’m not spotting anything in the IE6 that comes from IETester.

It’ll take someone with an actual IE6 browser to confirm/debug.

thanks for the reply. yes i also checked it with IETester and it was working fine but when i checked it in ie6 actual browser then it showed me the problem.:confused: Actually I need to give this project in around 4 hours. A quick help will be very appreciated.

hey pmw57

when i put the code on the page instead of attaching it is working fine. I thing there is a problem with the code that i used to attched the file. you can check the changed file below

clarysolar.com/HTML/residential-solar2.html

also it seems to be working fine when i use the script tag on the head of the page. check the below mentioned URL

clarysolar.com/HTML/commercial-Solar3.html

I think it is some kind of IE rendering problem because when i refresh the original page it also works fine.

for every one reference 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';
		}
	}
}

I think after putting code on the top it seems to be working fine in IE6 any one can please confirm it
clarysolar.com/HTML/residential-solar.html

[ot]
This is offtopic, but I’d love to know: why are you requiring everyone have Javascript just to use your menu? I can’t get further than the main page. That means google can’t either. There may well be a good reason, I’m just saying I’m curious as I hate doors being closed in my face : (

*edit ah I can use the other menu, though they’re not the same pages? [/ot]

*edit I just checked in a native IE6 on a Windows in Virtual Box (that shouldn’t matter…) and if the main page body is supposed to change when someone clicks on the tabs, it seems to work in IE6.

Ideally what you’d want is to have all those parts of the page show up by default (for those without JS… people without JS DO expect pages to be uglier and weirder than with JS so, no problem) and have the anchors actually skip to the lower parts of the page (using url fragments and id’s on the headers of each section)…
then have Javascript, when it loads for those who can run JS, set all those parts to display: none like you’re doing now, and set the anchors to
return false;
so those with JS on don’t get shuffled to some other part of the page.

Off Topic:

That and removing some strange alt text and this could be a page that works for everyone (I noticed you have scripts dealing with Netscape 4 and 6, and IE4, so I figured you’re trying to be very VERY cross-browser, so of course you want to tell the non-JSers about solar… I personally have been a fan of residential solar for a long time and used to subscribe to Home Power Magazine for years : )

Stomme poes . Good to know that it is working. I absolutely agree with you regarding JS tabs. The solution that you gave is ideal. I usually don’t like this kind of effects which create more trouble then ease but the problem is I was given a task to recode the pages to remove some cross browser errors and these tabs were used by the previous coder so i have to use these tabs in order to satisfy my client. I change the complete code including JavaScript. I still haven’t figured out how to use the Bing map.

About strange alt text :smiley: that is for Validation. I will try to update them.

by the way of you want to check the previous code check it

clarysolar.com/

Hi trafford:

About strange alt text that is for Validation. I will try to update them.

The only thing the validator knows is if you included the attribute. So, always have the attribute.

However the reason for using the alt attribute is for those who can’t see images who may be giving information. Some images don’t, or are difficult to turn into text. Those would be either alt=“” (which is perfectly valid, esp for images that should be CSS backgrounds but for some reason are in the HTML) or for things like graphs, if they are showing something important, maybe would be better linked to a table that shows the same thing (or, there’s also a few ways using either CSS or JS to style an HTML table into a graph… but let’s not add more work at this point!).

You’ve got this:

(header)Smith Home Photos

smith first smith huse smith house second
home third smith second carol smith
box Bottom
Solar recomendation
box head
blank profile

(header)Rick E. - Home

That’s going to confuse anyone who can’t see anything… I only saw it by turning CSS and images off which is something I often do when dealing with pages where I can’t get to the content because I don’t have JS on. So if you have an image and it’s decoration, you’ll do humans a favour with alt=“” and satisfy the validator. For things that are content, a better description and/or some link to something that makes more sense (since alt is intended to be rather short and the whole longdesc/D-links things didn’t seem to pan out cross browser) would do it.

So like, for the images with text (“sunlight goes in, energy comes out”) that’s your alt text.

For the images above each item (panel, inverter, meter) those are decorational and should be alt=“”
Not sure about teh graphic showing the parts as they relate to the house…

for the photos of the house, you can decide… I would not describe what the photos are showing (panels on the roof, panels on the roof, another angle, blah) but maybe the first photo could mention “photos of the panels on the roof” as that would let me know what those photos are doing there on the page… and the webAIM screen reader survey seemed to support that (results were very clear on why though… )… do whatever makes the info make the most sense when viewed as a pure document and you’ll mostly be okay.

by the way of you want to check the previous code check it

clarysolar.com/

Yeah, I get even less there as I don’t have Flash player installed on this machine, lawlz. At least you’ve got some content (and though you’re hiding it by default with the CSS, the googles don’t load JS or CSS and you’ve got all the info there in the document so the googles will see all that content which is good… with Flash that’s still not so, except with the accessibility text you can add to Flash).

This may be compltely out of left-field, but perhaps the following from DSSTester’s General PC Discussion will be of use.

OK this was driving me nuts here is the
fix.This is straight from dexter himself might fix your problem also

A lot of people are having problems after upgrading to Windows ME, Windows 2000, and IE6.
If you get “OBJECT Expected on line 1” or “Line too long on line 1” when you start WinExplorer, here is the fix:

Run regedit.exe and delete the following key:
“HKEY_CURRENT_USER\Software\Dream Company”

This will fix the problem

Hi Stomme poes
Thanks for the detail analysis and advices. I will remember your tips next time when i will code specially the alt=“” one. As a newbie i am still learning and trying to improve my self. Anyway I appreciate you time and efforts. Just curious that why you turned of your JavaScript. Is it for security reason.

@pmw57 thanks for the help i appreciate it.

I’m glad you appreciate it. May I ask though, was it effective? Or is further investigation warranted?

I should mention I didn’t test IE6 “hard”… I opened the site and clicked on stuff. You never said if you found what the original problem was or if you’re sure it’s fixed.

Stomme poes. Yes I am sure it is fixed . Before I was using the script on the bottom of the page but placing it on the top solved the problem.

pmw57. Actually the General PC Discussion thread was about 9 years old and the solution was for the Pcs running windows XP. I am sure it will help anyone who is running windows Xp and having the same problem. But since the XP is upgraded to service packs, I think thy might had solved that issue.:slight_smile: Also it was for the client PCs.

Do you have any extra information to add about these computers running IE6, that are having trouble with your web page, that might help others here to find a solution for you.

I was using windows XP sp2 and IE 6.0. Also I test the site on IETestor on vista with the same problem.
After testing the problem i was able to fixed the problem by placing the script on the top. I was also able to fixed the same problem with the Bing map script by placing the Bing code on top. So i think if any one having a same problem putting the script on the top might solve the problem. I think IE has some kind of rendering problem with the scripts on the bottom.