根据单选按钮的可见性 [英] visibility of forms according to radio button

查看:63
本文介绍了根据单选按钮的可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个单选按钮.
选中第一个单选按钮时,form1将可见,并且
当第二个单选按钮被选中时,form2将可见...
我该怎么做..

i have two radio buttons.
when 1st radio button is checked form1 will be visible and
when 2nd radio button is checked form2 will be visible...
how i can do this..??

推荐答案

它与ASP.NET无关,因为所有事情都应该在JavaScript的客户端完成.我建议使用jQuery:
http://en.wikipedia.org/wiki/JQuery [ http://jquery.com/ [ ^ ].

例如,在您的HTML中
It has nothing to do with ASP.NET, as everything should be done on the client side in JavaScript. I would advise using jQuery:
http://en.wikipedia.org/wiki/JQuery[^],
http://jquery.com/[^].

For example, having in your HTML
<form id="first" ... > ... </form>
<form id="second" ... > ... </form>

...

<input type="radio" id="showFirst" ... >Show First</input>
<input type="radio" ... >Show Second</input>



您可以通过JavaScript处理可见性,例如:



you can handle visibility by JavaScript, something like:


(文档).ready(函数(){ firstForm =
(document).ready(function(){ firstForm =


(" ); // 一个jQuery包装器,由ID选择器找到的表单元素 secondForm =
("#first"); // a jQuery wrapper, form element found by ID selector secondForm =


这篇关于根据单选按钮的可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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