This article share the click button to realize the hidden and display of the switch code, for your reference, the specific contents are as follows
Effect Chart:
In many applications, there is such a function, click the same button to achieve an element of the display and hidden switch, the following is a code example to introduce how to achieve this effect, the code is as follows:
The above code to achieve our requirements, click on the top link to achieve a div display and hidden switch, the following describes its implementation process.
Implementation principle:
Registers the OnClick event handler function for a link, This handler can determine the value of the DIV's Style.display property and set it to none for block, which means that the div is set to hidden, otherwise it is set to block, that is, the div is set to display state, which is the principle. What needs special attention is that in Div, the reason why the use of style= "Display:block" is to let Obj.style.display statements can get property values, otherwise the first click can not be set to hide div, we can remove style= " Display:block "Do the test, return false statement is to prevent the link jump effect."
For return FALSE, refer to this article: "return false in learning Jquey"
The above is the entire content of this article, I hope to help you learn.