Saturday, 17 August 2013

Javscript Code isn't working under XP

Javscript Code isn't working under XP

I am using this JS code for show and hide some div elements on my side -
it is working perfectly on W7/W8 and all browsers, but for XP it doesn't
work at all, am I something missing about JS libraries supported in XP or
something?
Thanks for any replies in advance.
<script type="text/javascript">
var divState = {};
function showhide(id) {
if (document.getElementById) {
var divid = document.getElementById(id);
divState[id] = (divState[id]) ? false : true;
//close others
for (var div in divState){
if (divState[div] && div != id){
document.getElementById(div).style.display = 'none';
divState[div] = false;
}
}
divid.style.display = (divid.style.display == 'block' ? 'none'
: 'block');
}
}
</script>

No comments:

Post a Comment