一个控件动态替换另一个控件 [英] One control replacing another one Dynamically

查看:144
本文介绍了一个控件动态替换另一个控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..

我的网页上有一个文本框.用户单击它的那一刻应在同一位置替换为下拉列表控件.
我可以打开或关闭可见性,但是我不知道该怎么做.

有任何建议吗?

Hi..

I have a textbox on my web page. The moment user clicks on it should replace by a Dropdown List control at the same place.
I can switch visibility on or off But I don''t know how to go about it.

Any suggestions please??

推荐答案



在页面中采取两个控件.一个是文本框,另一个是下拉列表.
设置dropdon的CSS样式,如下所示:
Hi,

Take two controls in page. One is Textbox and another is Dropdown.
Set the css style for dropdon as below:
.DropDown{
      display:none;
}


单击文本框时使用此javascript编码:


Use this javascript coding on click of textbox:

function fnShowDropDwn(){
     var txt=document.getElementById("MyTextBox1");
     txt.style.display='none';
     var ddl=document.getElementById("MyDropDown1");
     ddl.style.display='';
}



祝一切顺利.
--Amit



All the best.
--Amit


这篇关于一个控件动态替换另一个控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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