<script language="javascript" >
function returnindex(){
alert("我们要回首页啦!");//这一句能够执行的,可是下面的好像直接略过了
//location='./index.php'
parent.location.href="index.php";

} </script>看表单
<form id="form1" name="form1" method="post" action="execute.php">
.
.
.
    <input type="submit" name="Submit2" value="返回" onClick="return returnindex()">试了,location,和parent.loaction,都不管用
是不是,表单的话,只能选择跳到表单的地址和,不跳,,没有去别的地方的可能?

解决方案 »

  1.   

    parent.location.href="index.php";
    下面加上return false;
      

  2.   

    楼主可以再调试一下javascript代码,这个应该和form没关系,应该是javascript的问题,因为alert("");直接就输出了,下面的并没有执行,个人想法,呵呵。
      

  3.   

    楼主现在是一个submit按钮 你这样试试 
    这是楼主的代码
     <form id="form1" name="form1" method="post" action="extcute.php">
     <input type="submit" name="Submit2" value="返回" onClick="return returnindex()"> <form id="form1" name="form1" method="post" action="extcute.php" onsubmit="return returnindex()">
     <input type="submit" name="Submit2" value="返回">
      

  4.   

    刚才说错了 他本身就是一个submit按钮 你提交它只会访问到action="extcute.php"  
    parent.location.href="index.php";这句肯定访问不到
      

  5.   

    如果楼主 想让他执行 你可以换成普通按钮button
      

  6.   

     <input type="button" name