mirror of
https://github.com/rn10950/RetroZilla.git
synced 2024-11-14 03:30:17 +01:00
65 lines
1.4 KiB
HTML
65 lines
1.4 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|
|
|
<style>
|
|
|
|
#table {
|
|
border: 8px solid #000;
|
|
background-color: #fff;
|
|
padding: 50px;
|
|
width: 400px;
|
|
height: 200px;
|
|
}
|
|
|
|
#cell {
|
|
background-color: #fff;
|
|
}
|
|
|
|
</style>
|
|
|
|
<script>
|
|
|
|
var ix;
|
|
var a= new Array( "#f00", "#0f0", "#00f", "#000", "#ff0", "#f0f", "#0ff", "#fff" );
|
|
var len= a.length;
|
|
var what= "table";
|
|
var elem;
|
|
var text;
|
|
var id;
|
|
|
|
function Init( arg ) {
|
|
what= arg;
|
|
elem= document.getElementById( arg );
|
|
text= document.getElementById( "text" );
|
|
text.value= elem.style.backgroundColor;
|
|
ix= 0;
|
|
}
|
|
|
|
function Change() {
|
|
elem.style.backgroundColor= a[ix++];
|
|
if ( ix >= len ) ix= 0;
|
|
text.value= elem.style.backgroundColor;
|
|
}
|
|
|
|
</script>
|
|
|
|
<body onload="Init('table')">
|
|
|
|
Change the color on the table more than once.
|
|
<BR>
|
|
<table id=table><tr>
|
|
<td id=cell></td>
|
|
</tr></table>
|
|
|
|
<form>
|
|
<p>Change
|
|
<label><input type=radio name=radio onclick="Init('table')"> Table</label>
|
|
<label><input type=radio name=radio onclick="Init('cell')"> Cell</label>
|
|
color</p>
|
|
<p><input type=button onclick="Change()" value="Change Color">
|
|
Table/Cell backgroundColor is <input id=text type=text size=16></p>
|
|
<p><input type=button onclick="window.id= setInterval( Change, 1000 )" value="Set Interval">
|
|
<input type=button onclick="clearInterval( window.id )" value="Clear Interval"></p>
|
|
</form>
|
|
|
|
</body>
|