[spoiler="Cкрин"][/spoiler]
1. В head пихаем:
Code
<script type="text/javascript" >
var value = 0;
function setOpacity() {
value += .7;
var testObj = document.getElementById('test');
testObj.style.width = "100%";
testObj.style.height = "200%";
testObj.style.display = "block";
testObj.style.opacity = value/7;
testObj.style.filter = 'alpha(opacity=' + value*7 + ')';
myTimeout = setTimeout("setOpacity()", 1);
if ((value/10) >= .5) {
clearTimeout(myTimeout);
}
document.getElementById('warning').style.display = "block";
}
function removeOpacity() {
value -= .3;
var testObj = document.getElementById('test');
myTimeout2 = setTimeout("removeOpacity()", 1);
testObj.style.opacity = value/7;
testObj.style.filter = 'alpha(opacity=' + value*7 + ')';
if ((value/10) <= 0) {
testObj.style.display = "none";
clearTimeout(myTimeout2);
}
document.getElementById('warning').style.display = "none";
}
</script>
2. Выводим кнопки.. (где надо ставьте)
Code
<div id="test"></div>
<div id="warning">
<a href="javascript://" onclick="removeOpacity();">Включить свет</a>
</div>
<div style="padding:10px 5 5px 5;position: absolute;">
<a href="javascript://" onclick="setOpacity();">Выключить свет</a>
</div>