Click here to Skip to main content
15,896,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

I have used a javascript fo showing date with time on master page,it works fine,but there is a problem i.e this function doesn't work in mozilla browser.How to solve this problem???

my javascript function is given:

XML
<script type="text/javascript">
    function getdate1() {
        setInterval("getdate1()", 1000);

        var currentDate = new Date()
        var day = currentDate.getDate()
        var month = currentDate.getMonth() + 1
        var year = currentDate.getFullYear()
        var currentTime = new Date()
        var hours = currentTime.getHours()
        var minutes = currentTime.getMinutes()
        var seconds = currentTime.getSeconds();
        if (minutes < 10)
            minutes = "0" + minutes
        var div = document.getElementById("div1");

        div.innerText = day + "/" + month + "/" + year + "     |     " + hours + ":" + minutes + ":" + seconds;

    }
</script>


It is called on body onload event and date is showing in a div.

Thanks
Posted

1 solution

replace
JavaScript
div.innerText =

with
JavaScript
div.innerHTML =
 
Share this answer
 
Comments
deepa5 21-Jan-12 2:51am    
thanks....
deepa5 21-Jan-12 2:51am    
its working...
Sergey Alexandrovich Kryukov 21-Jan-12 4:32am    
This is a catch, really. My 5.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900