JS部分<script>function showPage(index){
if(index==1)
document.getElementById("showFrame").src="test1.jsp";
else if(index==2)
document.getElementById("showFrame").src="test2.jsp";
else if(index==3)
document.getElementById("showFrame").src="test3.jsp";
}
</script>网页部分<body><a href="" onclick="showPage(1);">测试</a>
<a href="" onclick="showPage(2);">添加1</a>
<a href="" onclick="showPage(3);">添加2</a><br>
<iframe id="showFrame" frameBorder="0" scrolling="auto" src="" width="100%" align="left"></iframe>
</body>为什么当我点击超链接的时候,eclipse会提示指定的路径拒绝访问,网页显示为空白,test1、test2、test3都和网页在一个文件夹内,应该不存在跨域问题,访问的时候我是使用localhost进行访问

解决方案 »

  1.   

    应该不会吧。你是不是把上面放在另一个frame里了?
    或者你把上面的内容保存为单独一个文件试试
      

  2.   

    <iframe name="showFrame" frameBorder="0" scrolling="auto" src="" width="100%" align="left"></iframe>window.frames["showFrame"].location="test1.jsp";
      

  3.   

    <a href="" onclick="showPage(1);return">测试</a>或者直接<a href="test1.jsp" target="showFrame">测试</a><iframe name="showFrame" frameBorder="0" scrolling="auto" src="" width="100%" align="left"></iframe>