你在点击图片同时,获得当前滚动条滚动得距离,并作为参数传到b页面,关闭B得时候,利用这个参数让A再重新滚动到这个位置就好了

解决方案 »

  1.   

    楼上的方法太麻烦了点吧可以用一个<a title="here">here</a>把这一句加到图片的上面!
    当子窗口涮新父窗口时,传一个href=here过来,就可以定位了相信这是最简单实用的了
      

  2.   

    windzjp(赵依燃-lastidea.net) :
    您的意思是这样么?我改的有什么不对么?还是没有效果啊?
    页面A:
    <a onclick="event.cancelBubble=true;" href="javascript:showCalendar()>
    <img src="../images/tb_31.jpg" width="18" height="21" border="0">
    </a>
    <a title="here">here</a>页面B:
     window.parent.location.href=here;
     window.parent.location.reload(); 
      

  3.   

    A页面:
    <a id="here"></a>
    <a href="Javascript:void(window.open('2.html'));">
    <img src="../images/tb_31.jpg" width="18" height="21" border="0">
    </a>
    B页面:
    onclick="opener.location.href=opener.location.href + '#here';window.close();"
      

  4.   

    不好意思,忘了你还要刷新。B页面代码改成:onclick="opener.location.reload();opener.location.href=opener.location.href + '#here';window.close();"
      

  5.   

    pli0825(女儿当自强):
    我按照您说的改了,页面是定回了A,地址栏的内容也是带 #here 这样的可就是没有定位到 here 还是在页面的顶部,请问这是什么原因?
      

  6.   

    锚点的名字是动态的:
    <a name="<bean:write name="myresource" property="id"/>"></a>B页:
        window.parent.location.reload();
        window.parent.location='/site/ViewProfile.do#'+id;我现在返回页A的地址栏内容是:
    http://localhost:8080/site/ViewProfile.do#56那里不对呢?
      

  7.   

    ViewProfile.do???.do是什么?我得是html页面
      

  8.   

    我是用在STRUTS框架中,各个有关系么?
      

  9.   

    不知道你说的是什么框架艾。我没用过。我只是简单的html页面。抱歉,力不从心。
      

  10.   

    其实我觉得应该和文件扩展名没有关系的,我还有一个差不多的功能,是在一个JSP页面定位的,window.location='/site/ViewProfile.do#<%=resourceId%>';就没有问题,在这个弹出的HTML页中定位  window.parent.location='/site/ViewProfile.do#'+id;就不行,不知道什么原因?
      

  11.   

    2楼其实正解,在最后的参数加一个xxx.location.href = "xxxx.do#image"
    后面的#Image就是瞄点哈,我以前做的项目就这样用的。最简单
      

  12.   

    xxx.location.href = "xxxx.do#image"
    我也试了,效果是一样的,地址栏显示的连接正确,但不定位,只是到顶端,和我在弹出的B页面定位A页面,而不是定位本页有关系?
      

  13.   

    你的 #image 锚点有定义吗?