js返回页面的问题:例:
index.jsp页面有个超链接,可以跳转到index2.jsp页面中,
index2.jsp页面中也有个链接或button,要跳回到index.jsp页面中,现在问题是:如果index.jsp页面中超链接跳转后,新打开一个到index2.jsp页面中,再想从index2.jsp页面中返回到index.jsp页面中,是返回,返回到已打开了的index.jsp页面中。而不是重新打开一个页面。求大牛指点。。谢谢。。

解决方案 »

  1.   

    用js的javascript:window.history.go(-1);就可以返回前一页。
    里面的复数就是离当前页的历史页数,-1就是之前的页。
      

  2.   

    <a href="javascript:history.go(-1)">返回</a>
      

  3.   

    也那是跳回来转回去的问题。
    你点一下,想返回到已打开了的index.jsp页面中。而不是重新打开一个页面。
    这个实现难度真的挺高。
    在当前页面跳转容易,在当前页面通过按钮切换到另一个页面,暂时还没见过这技术。
      

  4.   

    再问大家一个问题:js复制图片兼容各个浏览器的方法有木有。
    function CopyImage(img) {
    //var img=$("#img_wheel");
        
        var ctrl = document.body.createControlRange(); 
        img.contentEditable = true; 
        ctrl.addElement(img); 
        ctrl.execCommand('Copy'); 
        img.contentEditable = false; 
        alert('复制图片完成'); 
    }
      

  5.   

    这个只能在ie下运行没有错误!在chrome下和firefox下都不行,有木有解决方案。
      

  6.   


    String imgurl=request.getParameter("imgUrl");
    imgurl="http://localhost:8080/nods/"+imgurl;
    URL url = new URL(imgurl);
    System.out.println(imgurl);
            URLConnection conn = url.openConnection();
    //File file=new File(imgurl);
    BufferedImage bi =  ImageIO.read(conn.getInputStream());
    ByteArrayOutputStream ba = new ByteArrayOutputStream();
            ImageIO.write(bi, "PNG", ba);
            
    response.setContentType("image/png");
    response.setContentLength(ba.size());
    String fileName = Calendar.getInstance().getTimeInMillis()+".png";
        String headerStr = "attachment;filename=" + fileName;  
    response.setHeader("Content-Disposition", new String(headerStr.getBytes("GBK"), "ISO-8859-1")); 
    ServletOutputStream out =response.getOutputStream();
    ba.writeTo(out);
    out.flush();
    out.close();
    各位,这个下载图片的代码,执行后为什么没有反应呢,是不是哪有错呢,但是也没有抛出异常啊。这是什么情况?求指教
      

  7.   

    window.open("index.jsp",null,"height=200,width=400");
      

  8.   


    你异常抓取的部分,抓的是什么异常?  你catch(RuntimeException re) 试试,看是否有异常信息提示
      

  9.   

    window.history.back()
    再不行去请求后台action从action跳转到index.jsp
      

  10.   


    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    String imgurl=request.getParameter("imgUrl");
                    imgurl="http://localhost:8080/nods/"+imgurl;
                    URL url = new URL(imgurl);
                    System.out.println(imgurl);
                    URLConnection conn = url.openConnection();
                    //File file=new File(imgurl);
                    BufferedImage bi =  ImageIO.read(conn.getInputStream());        
                    ByteArrayOutputStream ba = new ByteArrayOutputStream();
                    ImageIO.write(bi, "PNG", ba);
                     
                    response.setContentType("image/png");
                    response.setContentLength(ba.size());
                    String fileName = Calendar.getInstance().getTimeInMillis()+".png";
                    String headerStr = "attachment;filename=" + fileName;  
                    response.setHeader("Content-Disposition", new String(headerStr.getBytes("GBK"), "ISO-8859-1")); 
                    ServletOutputStream out =response.getOutputStream();
                    ba.writeTo(out);
                    out.flush();
                    out.close();