开发者

Update html container with Javascript - Strange issue

开发者 https://www.devze.com 2023-01-08 13:30 出处:网络
I have a javascript function that is fired by a javascript timer. Every time the timer fires, I need to add an html string to a container that can accept & display html on the screen.

I have a javascript function that is fired by a javascript timer.

Every time the timer fires, I need to add an html string to a container that can accept & display html on the screen.

As more html is appended to the container, the container scrolls to the bottom.

开发者_高级运维

My problem is that the html stops getting shown after a while in the div, even though the alert is popping up with the correct value.

Am i implementing this incorrectly or am i using the wrong control to do this?

I am using asp.net & c#.

Here is the code i am using to find and enter html into a div (message is an input parameter of the function):

 var lbl = document.getElementById('lblMesssage');

      lbl.innerHTML += '<div><b><span style="color: red;">Message:</span></b><br />' + message + '<hr /></div>';
      alert('message: ' + message);

      lbl.scrollTop = lbl.scrollHeight;

Here is the HTML for the div:

  <div id="lblMesssage" style="overflow: scroll; border: solid 1px #3333FF; width: 98%;
    height: 100%;">
  </div>

Thanks for the help.

0

精彩评论

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