|
|
![]() |
|
Figure 3: Creating a Web site for all seasons. Continued from Figure 2: Customizing a Web site based on window size.
<html>
<head>
<style id="ssA" type="text/css"></style>
<script language="JavaScript">
<!--
var myDate = new Date();
var month = myDate.getMonth();
if (document.layers) {
if ((month == 10) || (month == 11)) {
document.classes.season.all.color = "red";
document.classes.season.all.backgroundColor = "green";
}
}
if (document.all) {
if ((month == 10) || (month == 11)) {
document.styleSheets["ssA"].addRule (".season", "color:red");
document.styleSheets["ssA"].addRule (".season", "background-color:green");
}
}
// -->
</script>
</head>
<body class="season">
<h1>JavaScript-Powered Stylesheets</h1>
<p>Isn't this cool?</p>
</body>
</html>
More World-Wide Web Published as Internet Builder in the 5/4/99 issue of PC Magazine. Related Links |
||||||||||||||
|
|||||||||||||||||||||||||||||||||||||
| TOP | Copyright (c) 1999 Ziff-Davis Inc. |