i have the bellow code for getting the date and time on button click.i want to get the output in a different color..what changes are needed?
<!DOCTYPE html>
<html>
<head>
<script>
function displayDate()
{
document.getElementById("demo").innerHTML=Date();
}
</script>
</head>
<body>
<h1>My First JavaScript</h1>
<p id="demo">click on the button bellow.....</p>
<button type="button" onclick="displayDate()">Display Date</button>
</body>
</html>
Try using the
object.style.colordocumentation here, so in your case