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>
精彩评论