Abhishek Zirota Abhishek Zirota - 1 year ago 95
HTML Question

My Javascript isn't printing anything

My code isn't printing anything. I am trying to print current time.

<script type="text/javascript">
function print(){
var now = new Date();
var hours = now.gethours();
var seconds = now.getSeconds();
var minutes = now.getMinutes();
document.write(hours + ":" + minutes + ":" + seconds + "<br/>");
setInterval("print()", 1000);

Answer Source

Just change var hours = now.gethours(); to var hours = now.getHours();

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download