Register.jsp页
==========
<script LANGUAGE="JavaScript">
      checkEmpty不具体写了
  
      function check(){
            if (!checkEmpty()){
                alert('someone is empty');
                window.location.href=('Register.jsp');            }
        } ------------
当弹出'someone is empty'点确定后,直接跳到登陆页面了,而且地址栏为http://localhost:8080/projectSystem/Register.action
我现在只想让他待在注册页面
谢谢

解决方案 »

  1.   

    取消提交不就得了<input   type="button"   text="提交"   onclick="checkForm(   this   )">  
       
      <script   language="javascript">  
      <!--  
      function   checkForm(   oForm   )  
          {  
              oForm.disabled   =   true;  
              if   (   confirm(   "确认提交吗?"   )   )  
              {  
                  if   (   checkEle(   oForm   )   )   oForm.submit();  
              }  
              oForm.disabled   =   false;  
              event.returnValue   =   false;  
          }  
       
      fuinction   checkEle(   oForm   )  
      {  
          do   some   check   ...  
      }  
      //-->  
      </script>   
      

  2.   

    window.location.href=     
    用'document.location.href='行不
      

  3.   


    LZ该补强JS了var name = document.all.yourname.valuevar name  = document.getElementById("d").valuevar name = docuemnt.forms[0].elements["yourname"].value
    if(name==""){
    alert("不能为空");
    return;
    }
    <form>
    <input type="text" id = "d" name="yourname" />
      

  4.   

    function check(){
                if (!checkEmpty()){
                    alert('someone is empty');
                    //window.location.href=('Register.jsp'); //注释或者删除这行不就呆在原页面吗?    
          }
            } 
      

  5.   


    为什么alert();之后  要让他 window.location.href=('Register.jsp'); 把这个删除不就好了
      

  6.   

    <script LANGUAGE="JavaScript">
          checkEmpty不具体写了
     
          function check(){
                if (!checkEmpty()){
                    alert('someone is empty');   
          }else
         {
            window.location.href="Register.jsp";    
         }

    这样不就可以了么???
      

  7.   

    楼主的 JS 验证 写在了 提交 之后了 所以页面跳转过去了 而他写 window.location.href=('Register.jsp');            这句 是想让 页面跳回来解决办法是 你的 JS 验证代码 要写在 表单提交之前验证不通过 则不提交表单 这样页面就不会变
      

  8.   


    在配置文件配置文件中配置注册画面初始化请求。window.location.href=/项目名/命名空间/注册画面初始化请求.action;
      

  9.   

    你适着在那链接后面在写一个  alert()
      如果还可抛出一句话,那么就可能是你window.location.href=('Register.jsp');    没有用啊
      因为可能你用的编译工具并不支持啊
     
      

  10.   

    支持10楼,window.location.href='Register.action';Register要在struts.xml里配.
      

  11.   

     window.location.href = "Register.jsp";