PDA

View Full Version : Need Help on Javascript Rotating Banner with clickable link to show DIV



slowph
03-14-2007, 06:01 AM
hi, i need help to show specific DIVs by clicking the previous and next buttons...the layers should rotate as it is now.

the page can be viewd here: http://etektonix.com/temp/quotecasestudy.htm

here's the code:

<script language="JavaScript1.2">

//IFRAME TICKER- By Dynamic Drive (http://www.dynamicdrive.com)

//configure delay between changing messages (3000=3 seconds)
var delay=6000

var ie4=document.all

var curindex=0
var totalcontent=0

function get_total(){
if (ie4){
while (eval("document.all.content"+totalcontent))
totalcontent++
}
else{
while (document.getElementById("content"+totalcontent))
totalcontent++
}
}

function contract_all(){
for (y=0;y<totalcontent;y++){
if (ie4)
eval("document.all.content"+y).style.display="none"
else
document.getElementById("content"+y).style.display="none"
}
}

function expand_one(which){
contract_all()
if (ie4)
eval("document.all.content"+which).style.display=""
else
document.getElementById("content"+which).style.display=""
}

function rotate_content(){
get_total()
contract_all()
expand_one(curindex)
curindex=(curindex<totalcontent-1)? curindex+1: 0
setTimeout("rotate_content()",delay)
}

window.onload=rotate_content

</script>

-----------------

on the body page:

<div id="content0" style="display:''">
<!-- ADD TICKER's CONTENT #0 HERE--------------------->
<a name="quote1" id="quote1"></a>
<table width="147" height="144" border="0" cellpadding="0" cellspacing="0" bgcolor="#6685A3">
<tr>
<td><table width="100%" border="0" cellspacing="10" cellpadding="0">
<tr>
<td class="highlight"><a href="#" target="_parent">&quot;Working with
patients is what i live for&quot;</a></td>
</tr>
<tr>
<td class="highlightSub">- Scott Brewster MD </td>
</tr>
</table></td>
</tr>
<tr>
<td height="20"><table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#FFFFFF">
<td height="1" colspan="2"><img src="images/spacer.gif" width="1" height="1"></td>
</tr>
<tr>
<td width="50%" align="left" valign="middle" class="buttons"><a href="#">&lt;previous</a></td>
<td width="50%" align="right" valign="middle" class="buttons"><a href="#">next&gt;</a></td>
</tr>
</table></td>
</tr>
</table>
<!-- END CONTENT #0----------------->

</div>

<div id="content1" style="display:none">
<!-- ADD TICKER's CONTENT #1 HERE--------------------->

<table width="147" height="144" border="0" cellpadding="0" cellspacing="0" bgcolor="#6685A3">
<tr>
<td><table width="100%" border="0" cellspacing="10" cellpadding="0">
<tr>
<td class="highlight"><a href="patients-come-first-a.htm" target="_parent">&quot;I
am writing to praise the care and dedication of Dr. Irv Edwards.
A few years ago...&quot;</a></td>
</tr>
<tr>
<td class="highlightSub">- Patient, CVMC </td>
</tr>
</table></td>
</tr>
<tr>
<td height="20"><table width="100%" height="20" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#FFFFFF">
<td height="1" colspan="2"><img src="images/spacer.gif" width="1" height="1"></td>
</tr>
<tr>
<td width="50%" align="left" valign="middle" class="buttons"><a href="#">&lt;previous</a></td>
<td width="50%" align="right" valign="middle" class="buttons"><a href="#">next&gt;</a></td>
</tr>
</table></td>
</tr>
</table>
<!-- END CONTENT #1----------------->
</div>

and so on...

Thanks for your help..