I am a newbie in web, now I'm studying JS. I have this simple script to be executed:
<script language="javascript">
var getDate = function() {
var doc = document.getElementById("demo");
doc.innerHTML = Date();
}
</script>
And this CSS rule for the label in which the script will be shown:
<style type="text/css">
.cstyle {
font-family: "Comic Sans MS", cursive;
}
</style>
In my document I have a button that triggers my script
<p id="demo"><span class="cstyle">Result.</span></p>
<button type="button" onClick="getDate()">Display Data</button>
When the document is being loaded "Result" is displayed with "Comic Sans" font. But when the mouse click has been happened, the date is displayed with the default font. This behaviour is abnormal, because script execution result is needed to be displayed with "Comic Sans" font too. How can I fix this?
[Upd.] Sorry for a little mistake, this is doc.innerHTML = Date(); instead of doc.innerHTML = arr.toString();