开发者

how to refresh the asp.net Label every second automatically using Java script instead ajax?

开发者 https://www.devze.com 2023-01-19 14:10 出处:网络
how to refresh the asp.net Label every second automatically using Java script inste开发者_如何学编程ad ajax?ajax is javascript in combination with a webrequest, so if you don\'t want to use ajax but o

how to refresh the asp.net Label every second automatically using Java script inste开发者_如何学编程ad ajax?


ajax is javascript in combination with a webrequest, so if you don't want to use ajax but only javascript the data has to come from somewhere else...

Put this at the end of your page and replace Label1 with the name of your Label for a nice working digital clock:

<script type="text/javascript">
function updateLabel(){
    document.getElementById('<%= Label1.ClientID %>').innerHTML = new Date(); 
    // replace new Date() with your updated value
    setTimeout("updateLabel()",1000);
}
updateLabel();
</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消