——————————————————————————
<script type="text/javascript">
function doPrint(){
window.open(\'print.html\');
}
</script>
————————————————————————
<body style="text-align:center">
<form>
<label>姓名:</label>
<input name="the_name" type="text"/>
<br>
<label>年龄:</label>
<input name="age" type="text"/>
<br>
<label>性别:</label>
<input name="gender" type="text"/>
<br>
<input type="button" onclick="doPrint();" value="打印"/>
</form>
</body>
————————————————————————
print.html :
<script type="text/javascript">
function init(){
var w = window.opener;
var f = w.document.forms[0];
var str = \'\';
str += \'姓名:\' + f[\'the_name\'].value;
str += \',年龄: \' + f[\'age\'].value;
str += \',性别: \' + f[\'gender\'].value;
document.body.innerHTML = str;
}
</script>
——————————————————————————