try:<iframe width="300" height="200" onload="b()" id="message" name=""message></iframe>
<script language="javascript">
function b() {
  frames["message"].document.designMode = "On";
  frames["message"].document.body.innerHTML = "<font color=red>Kao</font>";
}
</script>

解决方案 »

  1.   

    onload时iframe里面的对象没有完全初始化<body>
    <iframe width="300" height="200" id="message" name="message"></iframe>
    <script language="javascript">
    function b() {
      window.frames["message"].document.designMode = "On";
      document.all.message.document.body.innerHTML = "<font color=red>Kao</font>";
    }
    </script>
    <input onclick=b() type=button>
    </body>
      

  2.   

    二楼:
    frames.document.message.document.body为空或不是对象三楼:
    一点 整个页面都成那个innerHTML里面的内容了改成手动的
    仍然提示那个错误:
    <body>
    <iframe width="300" height="200" id="message" name="message"></iframe>
    <script language="javascript">
    function b() {
      message.document.designMode = "On";
      message.document.body.innerHTML = "<font color=red>Kao</font>";
    }
    </script>
    <input onclick=b() type=button value="Try">
    </body>再改成这样 效果跟三楼一样:
    <body>
    <iframe width="300" height="200" id="message" name="message"></iframe>
    <script language="javascript">
    function b() {
      document.all.message.document.designMode = "On";
      document.all.message.document.body.innerHTML = "<font color=red>Kao</font>";
    }
    </script>
    <input onclick=b() type=button value="Try">
    </body>
      

  3.   

    你只写了<font>,没有BODY对象,当然会出现这种错误,改成下面的
    <iframe width="300" height="200" onload="b()" id="message"></iframe>
    <script language="javascript">
    function b() {
       message.document.designMode = "On";
       message.document.open();
       message.document.writeln("<body>");
       message.document.close();
       message.document.body.innerHTML = "<font color=red>Kao</font>";
    }
    </script>
    <input onclick=b() type=button>
      

  4.   

    倒是没有黄色惊叹号了
    但蹦出了个“Stack overflow at line:0”的弹出框