文本类型的
或者说是.jsp类型的

解决方案 »

  1.   

    我查了下,网上大概提到3种方法
      方法一:  
      做一个   <iframe   src="aaa.txt"   style="display:none"   name="textfilewin"></iframe>  
        js   再读取   iframe   中的内容.  
       
      方法二:  
      不用   frame/iframe   的话,可以用   xmlHTTP   的GET方法,读到文件的内容.
      
      方法三:
      用FSO
      

  2.   

    直白的说就是我要从下拉菜单中选中一个文件,比如file1
    我想在同一页面的文本框中显示文件file1的内容
    file1就是几个简单的数字而已
    就是这样的
      

  3.   

    有没有具体的代码
    方法二和三有点难以掌握
    用iframe应该更容易一些
    不过这样的话,不是要建一个子窗口,那就不在一个页面上了,要做跳转了
      

  4.   

    第一个不需要重新建页面,直接在页面就可以使用IFRAME;
    第二个:
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    xmlhttp = new ActiveXObject("Msxml2.XMLHTTP")
    xmlhttp.open("POST","http://bbs.51js.com/faq.php",true);xmlhttp.onreadystatechange=function(){
    if(xmlhttp.readyState==4)
    {
    alert(xmlhttp.responseText.split("\n")[1]);
    }
    }
    xmlhttp.send("");
    //-->
    </SCRIPT>
    第三个:
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    var ForReading=1;
    var fso=new ActiveXObject("Scripting.FileSystemObject");
    var f=fso.OpenTextFile("C:\\r.txt",ForReading,true);
    if(f.AtEndOfLine){
    alert('空文件!');
    }
    else{
    alert(f.ReadAll());
    }
    f.Close();
    //-->
    </SCRIPT>
      

  5.   

    要的是下面这种效果???
    test.htm<html>
    <head>
     <title>Test</title>
     <script type="text/javascript">
       function ShowMenu()
       {
         Menu.style.top=parseInt(Div1.offsetTop)+parseInt(Div1.style.height);
         Menu.style.left=parseInt(Div1.offsetLeft);
         Menu.style.display="";
       }
       function HideMenu(e)
       {
           Menu.style.display="none";
       }
       function ShowFile(url)
       {
         var myframe=document.getElementById('myframe');
         myframe.style.display="block";
         myframe.src=url;
       }
     </script>
    </head>
    <body>
    <div id="Div1" style="background-color:#AAAAAA;width:100px;height:20px" onmouseover="ShowMenu()" onmouseout="HideMenu('D')">菜单测试</div>
    <br />
    <div id="Menu" style="display:none;position:absolute;background-color:#999999;width:100px;z-index:1" onmouseover="ShowMenu()" onmouseout="HideMenu()">
    <table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr><td onclick="ShowFile('file1.htm')">file1</td></tr>
    <tr><td onclick="ShowFile('file2.txt')">file2</td></tr>
    <tr><td onclick="ShowFile('file2.htm')">file3</td></tr>
    </table>
    </div>
    <iframe style='display:none' id='myframe'></iframe>
    </body>
    </html>加粗的为文件中的内容
    file1.htm
    file1.htmfile2.txt
    file2.txtfile2.htm
    file2.htm