c# - Remove empty space when visible property is set to false using JavaScript - Stack Overflow

I'm having a DropdownList and when its Selected Value is changed (for ex: 0 ) I need to set the vi

I'm having a DropdownList and when its Selected Value is changed (for ex: 0 ) I need to set the visible property of a Panel to True and the visible property of another Panel to False.

and when another Value is selected I need to do Vice Versa Using JAVASCRIPT.

I'm currently achieving this but the space remains as it is. How can i remove the spaces also.

can anyone help me??

I'm attaching the code also.

function visible(val) {

    var ddl = document.getElementById("ddl_IDProof");
    var selectedFilterType = drpFilterType.options[ddl.selectedIndex].value;

    if (selectedFilterType == "0") {

        document.getElementById("pnl1").style.visibility = "visible";
        document.getElementById("pnl2").style.visibility = "hidden";
    }

    else {
        document.getElementById("pnl1").style.visibility = "hidden";
        document.getElementById("pnl2").style.visibility = "visible";
    }  
}

I'm having a DropdownList and when its Selected Value is changed (for ex: 0 ) I need to set the visible property of a Panel to True and the visible property of another Panel to False.

and when another Value is selected I need to do Vice Versa Using JAVASCRIPT.

I'm currently achieving this but the space remains as it is. How can i remove the spaces also.

can anyone help me??

I'm attaching the code also.

function visible(val) {

    var ddl = document.getElementById("ddl_IDProof");
    var selectedFilterType = drpFilterType.options[ddl.selectedIndex].value;

    if (selectedFilterType == "0") {

        document.getElementById("pnl1").style.visibility = "visible";
        document.getElementById("pnl2").style.visibility = "hidden";
    }

    else {
        document.getElementById("pnl1").style.visibility = "hidden";
        document.getElementById("pnl2").style.visibility = "visible";
    }  
}
Share Improve this question asked Aug 17, 2012 at 10:39 Krishna ThotaKrishna Thota 7,08617 gold badges58 silver badges79 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 6

Use display instead of visibility. This will hide the entire element:

    // Show pnl1 (maybe you have to use inline or inline-block insdead of block)
    document.getElementById("pnl1").style.display = "block";
    // Hide pnl2
    document.getElementById("pnl2").style.display = "none";

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745616467a4636266.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信