怎样在javascript,比如填写表单后得到结果,但还想重新再次输入内容,想返回输入页面,注意::输入页面和结果显示页面在同一页面,怎样做?

解决方案 »

  1.   


     <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
      <html xmlns="http://www.w3.org/1999/xhtml"> 
      <head> 
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
      <title></title> 
      <script language="javascript" type="text/javascript"> 
     function preview(){ 
      
     var zhanghao=document.form1.zhanghao.value; 
     var author=document.form1.author.value; 
     var note=document.form1.note.value; 
     var tel=document.form1.tel.value; 
      
     var pTag = document.createElement("div"); 
     pTag.innerHTML=" <table width='500' border='0' cellspacing='1' cellpadding='4' align='center'>"+" <tr> <td class='zhanghao' >"+zhanghao+" <hr> </td> </tr>"+" <tr> <td >作者:"+author+" </td> </tr>"+" <tr> <td class='news'>"+note+" </td> </tr>"+" <tr> <td class='news'>"+tel+" </td> </tr>"+" </table>"+" <p align='center'> <button onclick='document.form1.submit();'>提交 </button>"; 
      document.body.appendChild(pTag) 
      
      
     } 
      </script> 
      
      </head> 
      
      <body> 
      
      <form action="b.php" method="post" name="form1"> 
      <input type="text" name="zhanghao" > 
      <input type="text" name="author" > 
      <input type="text" name="note" > 
      <input type="text" name="tel" > 
      
      <input type="button" value="tijiao" onclick="javascript:preview();"> 
      </form> 
      
      </body> 
      </html> 
      

  2.   

    用ajax,然后用innerHTML在div显示内容
      

  3.   


    AJAX这么普遍,为什么不用?AJAX提交页面不刷新。
      

  4.   

    在一个页面,那么在文本框内输入再输入不就是得到结果了吗
    要不你就弹出个div,在div内输入东西,反显到父页面,然后关闭弹出层