一般情况下,一个html文件是输出到浏览器窗口中显示的,但是我想实现:把一个html文件输出到一个input类型的控件上去显示,请问高手如何实现?

解决方案 »

  1.   

    我试了下面的做法,结果什么都没有显示:<input id="input1" type="text" >
     <frame name="NavigetionFrame" src="Navigation.htm" frameborder="1">
    </input>
      

  2.   

    页面上嵌入一个iframe,iframe的src就是你那html地址,就可以显示了
      

  3.   

    是在html控件上显示html代码还以如上回答的?
      

  4.   

    试一试这个:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <script language="javascript" type="text/javascript">
    window.onload=function(){
    var s=document.body.innerHTML;
    var b1=document.getElementById("b1");
    b1.value=s;
    }
    </script>
    </head><body>
    <form id="form1" name="form1" method="post" action="">
      <label>
        <input name="b1" type="button" id="b1" value="" />
      </label>
    </form>
    </body>
    </html>
      

  5.   

    真是快死掉了,怎么都没法向iframe中写入这句:
    <a href="javascript:parent.location='HomePage.htm'">重定向到HomePage.htm</a>结果所写入的句子总是变成这样:
    <a homepage.htm="" href="javascript:parent.location=">重定向到HomePage.htm</a>大家可以亲自试验一下我的代码:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <body>
     <input id="in1" type="" value="hello"/><div id="ad" style="position:absolute">
        <iframe id="if1" src="" width="250" height="200"  frameborder="0" MARGINWIDTH="0" MARGINHEIGHT="0">
        </iframe> 
    </div><script type="text/javascript">
       document.getElementById("if1").contentWindow.document.write("<a href="javascript:parent.location='HomePage.htm'">重定向到HomePage.htm</a>");
    </script>
    </body>
    </html>
      

  6.   


      document.getElementById("if1").contentWindow.document.write(" <a href=\"javascript:parent.location='HomePage.htm'\">重定向到HomePage.htm </a>"); 
    加两个\转义就行了