js怎么关闭打印弹框

JavaScript021

js怎么关闭打印弹框,第1张

1、单纯的关闭

window.opener.location.reload()//刷新父窗口中的网页

window.close()//关闭当前窗窗口

2、提交后关闭

function save(){

document.getElementById(“pointsform”).submit()

alert(‘保存成功’)

window.opener.document.getElementById(“cmd”).value=”query”

window.opener.document.getElementById(“form的id”).submit()//提交

window.close()//关闭当前窗口

}

1、单纯的关闭

window.opener.location.reload()//刷新父窗口中的网页

window.close()//关闭当前窗窗口

2、提交后关闭

function save(){

document.getElementById("pointsform").submit()

alert('保存成功')

window.opener.document.getElementById("cmd").value="query"

window.opener.document.getElementById("form的id").submit()//提交

window.close()//关闭当前窗口

}

1、在html中的表单form设置属性action='#'防止自动提交 2、利用js获取html中表单form,重新设置表单的action 3、action设置完毕后调用form.submit()方法提交表单 4、表单提交后利用window.close()关闭当前窗口

button按钮也可以的啊,一样的使用方法啊,在js中提交的,还是说你想根据不同的按钮将form1表单提交到不同的action里?

<script type="text/javascript">

function sub(){

document.form1.submit()

}

</script>

 <body>

   <form action="Getvalue" method="post" name="form1">

   <input type="text" name="username"><br/>

   <input type="password" name="password"><br/>

   <input type="button" value="button测试" onclick="sub()">

   </form>

 </body>