最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin1浏览0评论

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";
发布评论

评论列表(0)

  1. 暂无评论