Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<style type="text/css">
#dropcontentsubject{
width: 250px;
font-weight: bold;
}
.dropcontent{
width: 250px;
height: 200px;
border: 1px solid black;
background-color: #DFDFFF;
padding: 3px;
display:block;
}
</style>
<script type="text/javascript">
/***********************************************
* ProHTML Ticker script- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
var tickspeed=2000 //ticker speed in miliseconds (2000=2 seconds)
var enablesubject=1 //enable scroller subject? Set to 0 to hide
if (document.getElementById){
document.write('<style type="text/css">\n')
document.write('.dropcontent{display:none;}\n')
document.write('</style>\n')
}
var selectedDiv=0
var totalDivs=0
function contractall(){
var inc=0;
while (document.getElementById("dropmsg"+inc)){
document.getElementById("dropmsg"+inc).style.display="none";
inc++;
}
}
function GoTo(nu,ms){
if (document.getElementById("dropmsg"+nu)){
clearTimeout(GoTo.to);
selectedDiv=nu;
expandone(ms||tickspeed);
}
return false;
}
function expandone(ms){
var selectedDivObj=document.getElementById("dropmsg"+selectedDiv);
contractall();
document.getElementById("dropcontentsubject").innerHTML=selectedDivObj.getAttribute("subject");
selectedDivObj.style.display="block";
selectedDiv=(selectedDiv<totalDivs-1)? selectedDiv+1 : 0;
GoTo.to=setTimeout(function(){ expandone(); },ms||tickspeed);
}
function startscroller(){
while (document.getElementById("dropmsg"+totalDivs)!=null){
totalDivs++;
}
expandone();
if (!enablesubject){
document.getElementById("dropcontentsubject").style.display="none";
}
}
if (window.addEventListener)
window.addEventListener("load", startscroller, false)
else if (window.attachEvent)
window.attachEvent("onload", startscroller)
</script>
</head>
<body>
<div id="dropcontentsubject"></div>
<div id="dropmsg0" class="dropcontent" subject="What is JavaScript?">
JavaScript is a scripting language originally developed by Netscape to add interactivity and power to web documents. It is purely client side, and runs completely on the client's browser and computer.
</div>
<div id="dropmsg1" class="dropcontent" subject="Java & JavaScript Differences">
Java is completely different from JavaScript- it's more powerful, more complex, and unfortunately, a lot harder to master. It belongs in the same league as C, C++, and other more complex languages. Java programs need to be compiled before they can run, while JavaScript do not.
</div>
<div id="dropmsg2" class="dropcontent" subject="What is DHTML?">
DHTML is the embodiment of a combination of technologies- JavaScript, CSS, and HTML. Through them a new level of interactivity is possible for the end user experience.
</div>
<input type="button" name="" value="GoTo 0" onmouseup="GoTo(0,5000);" />
<input type="button" name="" value="GoTo 1" onmouseup="GoTo(1);" />
<input type="button" name="" value="GoTo 2" onmouseup="GoTo(2,10000);" />
</body>
</html>
Bookmarks