How can I modify a code to change background color with different value from arduino using "If".
For example, if the value is bigger than 400, the background would be red and less than 400, the background would be white.
Here is my code,
<!DOCTYPE html>
<html>
<head>
<script src="jquery-2.0.3.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<title>Cubi-Fi Database</title>
<style type="text/css">
#autocolor{
width: 1000px;
height: 700px;
padding: 0.75em 0.5em 0;
text-align: center;
border: 1px solid black;
margin: 3em auto 0;
font: bold 90% sans-serif;
}
</style>
</head>
<body>
<div id="autocolor">
<font size=+2>
<font color=black>
<strong>
<em>
<h1>
Cubi-Fi
</em>
</strong>
</font>
</font>
</h1>
<div class="data">
</div>
<p id="demo"><body style="background: lightgray"> </p>
<script>
if ($("#temperatureDisplay").load('temperature_display.php') > 400) {
document.getElementById("demo").innerHTML = <body style="background: red">;
}
</script>
</body>
</html>
I modified this from this code,
<!DOCTYPE html>
<html>
<head>
<script src="jquery-2.0.3.min.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">
<title>Weather Station</title>
</head>
<body>
<div class="data">
<div class="dataTitle">Temperature: </div>
<div id="temperatureDisplay">Waiting for data ...</div>
</div>
<script type="text/javascript">
setInterval(function()
{
$("#temperatureDisplay").load('temperature_display.php');
}, 1000);
</script>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire