一个控件动态替换另一个控件
问题描述:
嗨..
我的网页上有一个文本框.用户单击它的那一刻应在同一位置替换为下拉列表控件.
我可以打开或关闭可见性,但是我不知道该怎么做.
有任何建议吗?
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