Click here to Skip to main content
15,905,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am showing current date and time to a textbox via javascript. But the below code is not working in IE 11. It's working in IE 8. I set alert messages and it is coming fine in IE 8 but not in IE 11.

Current Code is as below:
XML
<script type="text/javascript">
               var OutEnvelope = -1;
                var InEvelope = -1;
                //setInterval(function() { showStatus(); }, 5000);
        window.setTimeout("ShowTime()", 1000);
        function ShowTime() {

            var dt = new Date();
            alert(123);
            alert(document.getElementById("<%= TextBox1.ClientID %>").value);
            if(document.getElementById("<%= TextBox1.ClientID %>").value!='undefined')
            {
                document.getElementById("<%= TextBox1.ClientID %>").value = dt.toLocaleDateString() + ' ' + dt.toLocaleTimeString();

                window.setTimeout("ShowTime()", 1000);
            }

        }
Posted
Comments
[no name] 18-Nov-15 4:04am    
As per your code it should work Fine. Can you just clear browser history and reload the page again in IE.

1 solution

setTimeout definition says it receives function as parameter...so it would need to be
JavaScript
window.setTimeout (function () { ShowTime(); }, 1000);
or just
JavaScript
window.setTimeou(ShowTime, 1000);


I hope this helps, good luck.
 
Share this answer
 

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