简体   繁体   English

用于隐藏div的Javascript代码

[英]Javascript code to hide div

I would like to make a reservations formula but I have very low knowledge for javascript and ajax. 我想制定一个保留公式,但我对javascript和ajax知之甚少。

Here is a sample form: http://info.airprishtina.com/content/index.php?id=20&no_cache=1&L=0 以下是一个示例表单: http//info.airprishtina.com/content/index.php?id = 20&no_cache = 1&L = 0

When you Einfachflug in the Online buchen on the left, the divs that contain the destinations for returning flights disappear. 当您在左边的在线buchen中使用Einfachflug时,包含返程航班目的地的div将消失。 What is the best way to achieve this effect? 达到这种效果的最佳方法是什么? because I have seen different techniques but I would like to know what is the easiest and the best way! 因为我看过不同的技术,但我想知道什么是最简单最好的方法!

They change the style.visibility of the objects. 它们改变了对象的style.visibility。 That way the hidden objects will still take up space so the form does not change size. 这样隐藏的对象仍然会占用空间,因此表单不会改变大小。

Alternative is to change the style.display between "none" and "" or "block" Here is my example http://jsfiddle.net/mplungjan/VKxFT/ 另一种方法是更改​​“none”和“”或“block”之间的style.display这是我的例子http://jsfiddle.net/mplungjan/VKxFT/

Here is the actual code they use 这是他们使用的实际代码

function OneOrTwoWayClick() {
    var cb = getObject('fbengine_ui_flightsearchext_ascx_MultiCity');
    if (cb != null) {
        var rb = getObject('fbengine_ui_flightsearchext_ascx_Ticket2Way');
        if (rb.checked) {
            getObject('fbengine_ui_flightsearchext_ascx_MultiCityPanel').style.visibility = 'visible';
        } else {
            getObject('fbengine_ui_flightsearchext_ascx_MultiCityPanel').style.visibility = 'hidden';
            cb.checked = false;
            OnClickedMulticity();
        }
    }

    OneOrTwoWayChk();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM