ASDV-WebDev/Semester 1/Assignments/JavaScript/ch03/ex_3_1.html

21 lines
451 B
HTML

2023-03-14 09:48:18 +07:00
<html>
<head>
<title>Example 3.1</title>
<script>
function getTemp()
{
var temp = prompt("What's the temperature today?", "degrees Fahrenheit");
if (temp < 32)
{
document.write("<p>It may snow today!</p>");
}
}
</script>
</<head>
<body>
<h1>What's the Weather?</h1>
<h3>Click the button! </h3>
<p><input type="button" id="temperature" value="What is today's temperature?" onclick="getTemp();" /></p>
</body>
</html>