<!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;
<!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>
AJAX这么普遍,为什么不用?AJAX提交页面不刷新。
要不你就弹出个div,在div内输入东西,反显到父页面,然后关闭弹出层