单击弹出窗口中的按钮如何选中页面中的复选框并关闭弹出窗口 [英] On Clicking the button in popup how to check the checkbox in the page and close the popup

查看:89
本文介绍了单击弹出窗口中的按钮如何选中页面中的复选框并关闭弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我是Javascript的新手。我有一个复选框和链接(我同意条款)在注册页面。单击链接我使用条款和条件文本填充弹出窗口我有一个按钮(我同意)如果我在弹出窗口中单击iagree按钮我想检查我的注册页面中的复选框。

Hi,

Im new to Javascript. Im having one checkbox and link(i agree the terms)in register page. on clicking the link im populating the popup with terms&condition text in that i have one button (I agree) if i click iagree button in popup i want to check the checkbox in my register page.

推荐答案

它太简单了,假设你的popup id是''dvPopup''



点击关闭按钮后写下面的代码:



it''s too simple, suppose your popup id is ''dvPopup''

write the following code on click of close button:

document.getElementById('dvPopup').style.display = 'none';




on button click event:
window.close(); 
return false;





请指定复选框的位置



pls specify where is your check box


假设您的复选框ID为chk且位于表单form1内。



在弹出窗口的按钮点击事件上写:



Suppose your checkbox id is "chk" and it is inside a form "form1".

On popup''s button click event write:

window.opener.form1.chk.checked = true;
window.close();


这篇关于单击弹出窗口中的按钮如何选中页面中的复选框并关闭弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆