<a href="javascript:location.reload()" target="ifrm">出售</a>
<a href="http://localhost:8080/vote/test.jsp?id=001" target="ifrm">出售</a>如何把这两句合在一起,点击“出售”,在提交的同时刷新页面。注意:页面中有使用iframe。谢谢

解决方案 »

  1.   

    <script>
    function p(){
    location.reload();
    }
    alert ("reload!");
    </script>
    <button onclick="p();">
    <button onclick="window.open('b.htm')">
    ----------------------------------------------------------------
    <script>
    window.opener.p();
    </script>
      

  2.   

    <a href="http://localhost:8080/vote/test.jsp?id=001" onclick="window.location.reload()" target="ifrm">出售</a>
      

  3.   

    如果使用<a href="http://localhost:8080/vote/test.jsp?id=001" onclick="window.location.reload()" target="ifrm" >出售 </a >,那么下面的代码就不起作用了。
    <script type="text/javascript" language="javascript">
    <!--
    if(window.location.href.indexOf('#?')!=-1)
    {
    window.alert("产品已出售!");
    }
             if(window.location.href.indexOf('#!')!=-1)
    {
    window.alert("购买成功!");
    }
    //-->
    </script>
      

  4.   

    to lz:
    window.location.href是什么,从哪里来的,能不能说清楚点
      

  5.   

    点击url,根据返回结果,做出不同的相应    boolean vb=new VoteBean().voter(voter_code,elector_code,voter_ip);
                if(vb) {
                    response.sendRedirect("/vote/test.jsp#!");
                }else{
                    response.sendRedirect("/vote/test.jsp#?");
                }
      

  6.   

    o
    大概明白你的意思了
    是不是说reload()之后url后面的"#!"之类的符号丢失了?
    你试试在点连接之前把window.location.href输出来看看,有没有"#!"或者"#?"
    <script>
    alert(window.location.href);
    </script>如果有的话,就试试
    <a href="http://localhost:8080/vote/test.jsp?id=001" onclick="window.location.href=window.location.href" get="ifrm" >出售</a>
      

  7.   

    不过我发现用<a href="http://localhost:8080/vote/test.jsp?id=001" onclick="window.location.reload()" target="ifrm">出售</a>
    下面程序起作用的嘛!
    <script type="text/javascript" language="javascript"> 
    <!-- 
    if(window.location.href.indexOf( "#? ")!=-1){ 
    window.alert("产品已出售!"); 

    if(window.location.href.indexOf( "#! ")!=-1){
    window.alert("购买成功!"); 

    //-- > 
    </script>你可以试试下面代码:<html>
    <head>
    <title>出售(a.html)</title>
    <script type="text/javascript" language="javascript"> 
    if(window.location.href.indexOf("#?")!=-1){ 
    window.alert("产品已出售!"); 

    if(window.location.href.indexOf("#!")!=-1){ 
    window.alert("购买成功!"); 
    }
    </script>
    </head>
    <body>
    <input type=text>
    <a href="http://www.baidu.com" onclick="window.location.reload()" target="ifrm" >出售 </a > 
    </body>
    </html>
    然后在浏览器中输入此文件的路径,在后面加上"#!"或"#?",再单击连接
      

  8.   

    to 7楼好像不行的,好像不起作用
    <script type="text/javascript" language="javascript"> 
    if(window.location.href.indexOf("#?")!=-1){ 
    window.alert("产品已出售!"); 

    if(window.location.href.indexOf("#!")!=-1){ 
    window.alert("购买成功!"); 
    }
    </script>
      

  9.   

    <html>
    <head>
    <title>出售(a.html)</title>
    <script type="text/javascript" language="javascript"> 
    if(window.location.href.indexOf("#?")!=-1){ 
    window.alert("产品已出售!"); 

    if(window.location.href.indexOf("#!")!=-1){ 
    window.alert("购买成功!"); 
    }
    </script>
    </head>
    <iframe name="ifrm" width=0 height="0"></iframe>  
    <body>
    <input type=text>
    <a href="test.html#?" onclick="window.location.reload()" target="ifrm" >出售 </a > 
    </body>
    </html>
    直接点击出售,没有弹出对话框
      

  10.   

    <meta http-equiv="refresh"content="10">
    我想要类似这个的效果,是用点击“出售”来触发的,请问如何实现,谢谢俄