
Kod
<html>
<head>
<script type="text/javascript">
var c=1;
function kol()
{
var x = Math.round(100*Math.random());
document.getElementById('lol').style.backgroundColor='rgb(' + x + ',' + x + ',' + x + ')';
}
function zmiana()
{
if(??)
c=c+5;
document.getElementById('lol1').style.backgroundColor='rgb(' + c + ',' + c + ',' + c + ')';
if(??)
c=c-5;
document.getElementById('lol1').style.backgroundColor='rgb(' + c + ',' + c + ',' + c + ')';
}
</script>
<style>
#lol{
position:fixed;
left:100px;
top:150px;
}
#lol1{
left:250px;
top:0px;
position:relative;
}
</style>
</head>
<body>
<input type="button" value="Ustaw kolor" onclick="kol()"/>
<input id="p2" type="button" value="Jasniej" onclick="zmiana()"/>
<input id="p3" type="button" value="Ciemniej" onclick="zmiana()"/>
<div id="lol" style="width:200px;height:200px;border:1px solid blue;">
<div id="lol1" style="width:200px;height:200px;border:1px solid blue;">
</div>
</body>
</html>
<head>
<script type="text/javascript">
var c=1;
function kol()
{
var x = Math.round(100*Math.random());
document.getElementById('lol').style.backgroundColor='rgb(' + x + ',' + x + ',' + x + ')';
}
function zmiana()
{
if(??)
c=c+5;
document.getElementById('lol1').style.backgroundColor='rgb(' + c + ',' + c + ',' + c + ')';
if(??)
c=c-5;
document.getElementById('lol1').style.backgroundColor='rgb(' + c + ',' + c + ',' + c + ')';
}
</script>
<style>
#lol{
position:fixed;
left:100px;
top:150px;
}
#lol1{
left:250px;
top:0px;
position:relative;
}
</style>
</head>
<body>
<input type="button" value="Ustaw kolor" onclick="kol()"/>
<input id="p2" type="button" value="Jasniej" onclick="zmiana()"/>
<input id="p3" type="button" value="Ciemniej" onclick="zmiana()"/>
<div id="lol" style="width:200px;height:200px;border:1px solid blue;">
<div id="lol1" style="width:200px;height:200px;border:1px solid blue;">
</div>
</body>
</html>