/    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)) {
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() {
var thestory=(this.href).split(“#”,2)[1];
var currCenter = map.getCenter();
google.maps.event.trigger(map, ‘resize’);
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;}
var firstbutton=document.getElementById(‘buttons’).lastChild;
if (firstbutton.nodeType != 1) {firstbutton = firstbutton.previousSibling;}
firstbutton.className+=” current”; // set the ‘current’ class to the first button


to post a comment

0Be the first to comment 😎



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 6.19,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

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