/    Sign up×
Community /Pin to ProfileBookmark

Swap Content Script not working in IE

I used the below js to create a hidden tab page. It works great in safari and firefox but not working in IE. Anyone can help with getting it to work on IE will be great. Thx.

[CODE]function hideswapcontent () {
var divs=document.getElementById(‘swapcontent’).getElementsByTagName(‘div’);
for (j=0; j<divs.length; j++) {
var rE = new RegExp(“(^|\s)” + ‘story’ + “(\s|$)”);
if (rE.test(divs[j].className)) {
divs[j].style.display=”none”;
}
var buttons=document.getElementById(‘buttons’).getElementsByTagName(‘a’);
for (k=0; k<buttons.length; k++) { // loop throught the buttons and remove the ‘current’ class
var li=buttons[k].parentNode;
li.className=li.className.replace(new RegExp(“current”+”\b”), “”);
}}}

function swapcontent(first) {
var buttons=document.getElementById(‘buttons’).getElementsByTagName(‘a’);
for (i=0; i<buttons.length; i++) {
buttons[i].onclick=function() {
hideswapcontent();
var thestory=(this.href).split(“#”,2)[1];
document.getElementById(thestory).style.display=”block”;
if(thestory==”location”){
var currCenter = map.getCenter();
google.maps.event.trigger(map, ‘resize’);
map.setCenter(currCenter);
}
this.parentNode.className+=” current”; // set the ‘current’ class to the clicked button
return false;
}}
if (first) {
var firstone=document.getElementById(‘swapcontent’).firstChild;
if (firstone.nodeType != 1) {firstone = firstone.nextSibling;}
firstone.style.display=”block”;
var firstbutton=document.getElementById(‘buttons’).lastChild;
if (firstbutton.nodeType != 1) {firstbutton = firstbutton.previousSibling;}
firstbutton.className+=” current”; // set the ‘current’ class to the first button
}}

[/CODE]

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @phpnewbie08 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 4.20,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...