如何将控件放置在另一个控件上 [英] How to Place a control over anothere control

查看:99
本文介绍了如何将控件放置在另一个控件上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个可编辑的下拉列表用户控件.因此我想将文本框控件放置在dropdownlist控件上.所以它看起来像一个控件.但是我不能将文本框放在dropdownlist上.请帮助我.

I am creating a editable dropdownlist user control.So i want to place textbox control over dropdownlist control.So it looks like a single control.But i can''t place textbox over dropdownlist.Please help me.

推荐答案

这就是诀窍,

Here is the trick,

<div id="div1" style="position:absolute;top:80px;left:20px;width:80px;height:30px;display:none;">DOT.NET</div>
<div id="div2" style="position:absolute;top:80px;left:20px;width:80px;height:30px;">ASP.NET</div>
<input type="button" id="btn1" value="Change State" onclick="changeState();" />
        
<script type="text/javascript">
            function changeState() {
                if (document.getElementById("div1").style.display == "none") {
                    document.getElementById("div1").style.display = "";
                    document.getElementById("div2").style.display = "none";
                }
                else {
                    document.getElementById("div2").style.display = "";
                    document.getElementById("div1").style.display = "none";
                }
            }
</script>



因此,您可以在每个div中放置两个控件.

希望这会有所帮助.
欢呼



So, you can place your two controls within each div.

Hope this helps.
cheers


这篇关于如何将控件放置在另一个控件上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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