<script language="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;
//输出表单的值
document.write("<style>");
document.write("body,input,textarea,button{font-size:12px;}");
document.write(".zhanghao {font-size:16px;font-weight:bold;}");
document.write("table{border:1px solid #666666;background-color:#cccccc;"); document.write("td.news{line-height:120%;font-size:14px;text-indent:2em;}");
document.write("</style>");
document.write("</head>");
document.write("<body>");
document.write("<table width='500' border='0' cellspacing='1' cellpadding='4' align='center'>");
document.write("<tr><td class='zhanghao' align='center'>"+zhanghao+"<hr></td></tr>");
document.write("<tr><td align='center'>作者:"+author+"</td></tr>");
document.write("<tr><td class='news'>"+note+"</td></tr>");
document.write("<tr><td class='news'>"+tel+"</td></tr>");
document.write("</table>");
document.write("<p align='center'><button onclick='history.back();'>返回</button>");}
-->
</script>这句是插入记录时显示内容,如何修改查看后点击提交呢? 把返回改成提交?

解决方案 »

  1.   


    <?php
    header("Content-type: text/html; charset=gb2312")
    ?>
    <!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>