开发者

Onload event not working with Internet Explorer

I've written some very simple code on Internet Explorer 8 and I don't understand why nothing happens when I open the page with IE (why the text 'test' doesn't appear on the page).

I've tried on Firefox and Chrome and it works perfectly.

my code :

<html>
   <head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso 8859-1" />

   <script type="text/javascript">

   function display() {
      output.innerHTML+='test';
   }

   </script>

   <开发者_如何学Python/head>

   <body onload="display()">

      <div id="output">
      </div>
   </body>
</html>

Edit : let IE change your setting, don't do it by hand or it gets weird :-))


document.getElementById('output').innerHTML += 'test';


Try:

   function display() {
      document.getElementById('output').innerHTML+='test';
   }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜