<script language="javascript">
function datacheck() { //数据验证并提交表单
if(document.getElementById("sxhh").value==""){
alert("手写货号不能为空");
document.input1.sxhh.focus();
return false;
}
else if(document.getElementById("sdzmc").value==""){
alert("送达站不能为空");
document.input1.sdzmc.focus();
return false;
}
return true;
input1.target="preview";
input1.action="print.asp";
var win = window.open("about:blank","preview","directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=700,height=550,top="+(window.screen.height-550)/2+",left="+(window.screen.width-700)/2+"");
win.focus();
input1.submit();
}
</script>
<body>
<form>
<input type ="submit" value="打印预览(Alt+p)" accesskey="p" onClick="datacheck();">
</form>这是我的代码 谁给改造一下
function datacheck() { //数据验证并提交表单
if(document.getElementById("sxhh").value==""){
alert("手写货号不能为空");
document.input1.sxhh.focus();
return false;
}
else if(document.getElementById("sdzmc").value==""){
alert("送达站不能为空");
document.input1.sdzmc.focus();
return false;
}
return true;
input1.target="preview";
input1.action="print.asp";
var win = window.open("about:blank","preview","directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=700,height=550,top="+(window.screen.height-550)/2+",left="+(window.screen.width-700)/2+"");
win.focus();
input1.submit();
}
</script>
<body>
<form>
<input type ="submit" value="打印预览(Alt+p)" accesskey="p" onClick="datacheck();">
</form>这是我的代码 谁给改造一下
<!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=gb2312" />
<title>无标题文档</title>
</head>
<script language="javascript">
function datacheck() { //数据验证并提交表单
if(document.getElementById("sxhh").value==""){
alert("手写货号不能为空");
document.input1.sxhh.focus();
return false;
}
else if(document.getElementById("sdzmc").value==""){
alert("送达站不能为空");
document.input1.sdzmc.focus();
return false;
}
return true;
input1.target="preview";
input1.action="print.asp";
var win = window.open("about:blank","preview","directorys=no,toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,width=700,height=550,top="+(window.screen.height-550)/2+",left="+(window.screen.width-700)/2+"");
win.focus();
input1.submit();
}
</script>
<body ><form name="input1" METHOD="POST" onSubmit="document.getElementById('MaxIndex').value=Index;">
<table>
<tr>
<td><div align="center" class="style1">手写货号</div></td>
<td><input name="sxhh" type="text" id="sxhh" size="10" maxlength="10" onBlur="changejianshu();" onKeyDown="javascript:if(event.keyCode==13)event.keyCode=9"></td>
<td><input name="sdzmc" type="text" id="sdzmc" size="15" maxlength="15" onMouseMove="this.focus()" onFocus="this.select()" onKeyDown="javascript:if(event.keyCode==13)event.keyCode=9" ></td>
</tr>
</table>
<input type ="submit" value="打印预览(Alt+p)" accesskey="p" onClick="datacheck();">
</form>
</body>
</html>