可以<input type=file>选择后将nr.htm文件内容上传(方法很多)到服务器,然后通过服务器返回

解决方案 »

  1.   

    不想通过服务器。目前实现到这一步:
    <script language="JavaScript">
    function show_ckxyzjdywtz(){
    parent.main.document.location.href="file://"+document.fn.uploadfile.value
    }
    function show2(){
    var a,b,c,d;
    a=parent.main.document.all.tags("table");
    //a=parent.main.document;
    alert(a.length);
    //alert(a.rows(0).cells(0).firstChild.attributes.length);
    //c=a.rows(0).cells(0).firstChild.attributes;
    //alert(a.length);

    //c=a.rows(0).cells(0).attributes;
    //d="";
    //for(i=0;i<c.length;i++){
    // d=d+c(i).name+" = "+c(i).value+'\013';
    //}
    //alert(d);
    //alert(a.rows(0).cells(0).innerHTML);
    //alert("["+a.rows(1).cells(2).innerText.replace(/(\s*$)/g, "")+"]");
    }
    </script>
    <html>
    <head>
    </head>
    <body>
    <form name="fn">
    <table name="tab1" id="tabid1" border=0>
    <tr>
    <td>
    <input type=file name="uploadfile" size=100>
    <input type=button value="显示内容" onclick="JavaScript:show_ckxyzjdywtz()">
    <input type=button value="上传" onclick="JavaScript:upload_ckxyzjdywtz()">
    <input type=button value="TEST" onclick="JavaScript:show2()">
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
      

  2.   

    执行show2()函数时,语句a=parent.main.document.all.tags("table");出错“拒绝访问”
      

  3.   

    从http 到 file:///的访问属于跨域访问了
    如果不想通过服务器,就要用FSO对象,这涉及到安全和权限问题
      

  4.   

    对跨域的定义不了解。请教一下,如果一个frame的src设置为http://www.aaaa.com/a.asp,另一个frame的src设置为http://wwww.bbbb.com/b.asp,那么这2个frame之间是否就是跨域了?