Using the const Keyword : JavaScript DHTML examples (example source code) » Development » Timer

JavaScript DHTML
C++
Java Products
Java Articles
JavaScript DHTML Home  »   Development   » [  Timer  ]   
 



Using the const Keyword

Please note that some example is only working under IE or Firefox.

/*
JavaScript Bible, Fourth Edition
by Danny Goodman 

John Wiley & Sons CopyRight 2001
*/

<HTML>
<HEAD>
<TITLE>const(ant)</TITLE>
<STYLE TYPE="text/css">
.cold {font-weight:bold; color:blue}
TD {text-align:center}
</STYLE>
<SCRIPT LANGUAGE="JavaScript">
const FREEZING_F = 32
var cities = ["London""Moscow""New York""Tokyo""Sydney"]
var tempsF = [3312204075]
function showData() {
    var tableData = ""
    for (var i = 0; i < cities.length; i++) {
        tableData += "<TR><TD>" + cities[i"</TD><TD "
        tableData += (tempsF[i< FREEZING_F"CLASS='cold'" ""
        tableData += ">" + tempsF[i"</TR>"
    }
    document.getElementById("display").innerHTML = tableData
}
</SCRIPT>
</HEAD>
<BODY onLoad="showData()">
<H1>The const keyword</H1>
<HR>
<TABLE ID="temps">
<TR><TH>City<TH>Temperature</TR>
<TBODY ID="display">
</TBODY>
</TABLE>
</BODY>
</HTML>
Related examples in the same category
1.  Using a Timer
2.  setInterval() and clearInterval() methods
3.  A Countdown Timer
4.  Timer Events Demo
5.  Timer Events Demo 2
6.   Accessing Document Contents
7.  A Timeout Processing Example








Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.