/    Sign up×
Community /Pin to ProfileBookmark

Expand/Collapse Script does not support IE 6 and above

Hi,

The following code works fine in FF but when I see it IE 6 and above the collapse/expand does not work correctly. But when I remove the <!DOCTYPE>;ie. the document type declaration, it works fine…

Here is the script:

<script language=”javascript”>

function showhide(layer_ref,img) {

if (document.all) { //IS IE 4 or 5 (or 6 beta)
state = eval( “document.all.” + layer_ref + “.style.display”);
if ((state == ‘block’) || (state == ”)) {
state = ‘none’;
document.images[layer_ref + “img”].src= “http://stage.bedford.progress.com:9002/quantum/qtm53/images/” + img + “_un.gif”;
if (document.thisform) {
if (document.thisform.showhide) {
document.thisform.showhide.value = “U”;
}
}
} else {
document.images[layer_ref + “img”].src= “http://stage.bedford.progress.com:9002/quantum/qtm53/images/” + img + “.gif”;
state = ‘block’;
if (document.thisform) {
if (document.thisform.showhide) {
document.thisform.showhide.value = “H”;
}
}
}
eval( “document.all.” + layer_ref + “.style.display = state”);
}
if (document.layers) { //IS NETSCAPE 4 or below
state = document.layers[layer_ref].display;
if ((state == ‘block’) || (state == ”)) {
state = ‘none’;
document.images[layer_ref + “img”].src= “http://stage.bedford.progress.com:9002/quantum/qtm53/images/” + img + “_
un.gif”;
if (document.thisform) {
if (document.thisform.showhide) {
document.thisform.showhide.value = “U”;
}
}
} else {
state = ‘block’;
document.images[layer_ref + “img”].src= “http://stage.bedford.progress.com:9002/quantum/qtm53/images/” + img + “.gif”;
if (document.thisform) {
if (document.thisform.showhide) {
document.thisform.showhide.value = “H”;
}
}
}
document.layers[layer_ref].display = state;
}
if (document.getElementById &&!document.all) {
hza = document.getElementById(layer_ref);
state = hza.style.display;
if ((state == ‘block’) || (state == ”)) {
state = ‘none’;
document.images[layer_ref + “img”].src= “http://stage.bedford.progress.com:9002/quantum/qtm53/images/” + img + “_un.gif”;
if (document.thisform) {
if (document.thisform.showhide) {
document.thisform.showhide.value = “U”;
}
}
} else {
state = ‘block’;
document.images[layer_ref + “img”].src= “http://stage.bedford.progress.com:9002/quantum/qtm53/images/” + img + “.gif”;
if (document.thisform) {
if (document.thisform.showhide) {
document.thisform.showhide.value = “H”;
}
}
}
hza.style.display = state;
}
}

</script>

Please correct it…..The complete html file is attached.. Please please correct it…

Regards,
Ayusman

[upl-file uuid=b2db94f3-a740-447c-831c-67372666901a size=8kB]Untitled-5.zip[/upl-file]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@FangJun 12.2008 — Throw that code away, it's outdated. Use: http://www.dustindiaz.com/dhtml-expand-and-collapse-div-menu/
Copy linkTweet thisAlerts:
@ayusman_mohantyauthorJun 12.2008 — Hi Buddy,

But how may I modify this code to replace the old one...

Could you please help me?

Thanks,

Raj
×

Success!

Help @ayusman_mohanty spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...