/    Sign up×
Community /Pin to ProfileBookmark

Link rotate

Hi,
i try to make some simple link rotating script but i stuck in the middle.I want to change every 2 second the visibility of div layer.
Here is the code

<html>
<head>
<style>
.visible{border:solid 1px black;width:200;height:100;
display: block; background-color: #990099;
font-family: “Futura Lt BT”;font-size: 10pt;
color: #FFFFFF; padding-top:50; padding-left:50;}
.hidden{border:solid 1px black;
width:200;display: none;}
</style>

<script type=”text/javascript”>

function banner_change1()
{
banner1.className=’visible’;
banner2.className=’hidden’;
}
function banner_change2()
{
banner2.className=’visible’;
banner1.className=’hidden’;
}
function rotate()
{
var TimerID;
a=0;
while(a==0){
banner_change1();
TimerID=setTimeout(“banner_change2()”,2000);
return;
}

}
</script>
</head>
<body bgcolor=”#ADD8E6″ onload=”rotate()” >
<table height=”200″ border=”1″>
<tr>
<td width=”196″> <div id=”placeholder” style=”width:200;height:100;”>
<div id=”banner1″ class=”hidden” style=”background-color:#FF8090;”><a href=”#”>Link
One</a></div>
<div id=”banner2″ class=”hidden” ><a href=”#”>Link Two</a></div>
</div></td>
</tr>
</table>
</body>
</html>

I can`t figure what is wrong so if someone could help i be very pleased.

Thanks
Wrong

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@JPnycSep 25.2004 — Call the 1st function onload, or on whatever event you want, then:

function banner_change1()

{

banner1.className='visible';

banner2.className='hidden';

setTimeout('banner_change2()',2000);

}

function banner_change2()

{

banner2.className='visible';

banner1.className='hidden';

setTimeout('banner_change1()',2000);

}
Copy linkTweet thisAlerts:
@JPnycSep 25.2004 — Geez, I didn't even bother to look at the statements. I'm not going to rewrite the thing, but to access the property you want, you need to have this

document.getElementById('idNameHere').style.visibility='hidden';

or = visible, whichever.


Then you have to give the elements you want to affect an ID, not a class name.
×

Success!

Help @wrong 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.30,
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,
)...