Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - The meaning of the following code
The meaning of the following code
Function display submenu (sid)// Menu display

Function: Pass in a parameter sid to get his submenu object "submenusid". If the property of this object is hidden (whichEl.style.display == "none "), it will be displayed (whichEl.style.display ==" ").

Similarly, if it is displayed, hide it.

In this way, this js is called to hide and display the menu when you click something.

& lt scripting language = javascript & gt

//This is a function of explicit and implicit control of elements.

Function display submenu (sid)

{

WhichEl = eval ("submenu"+sid); //Convert "submenu" +sid into an executable statement. Eval means to calculate the value of an expression and return the result.

If (which el.style.display = = "none")//If the object is not displayed,

{

Eval ("submenu"+sid+",style.display = \" \ "); //The object is set to display

}

Otherwise//Otherwise

{

eval("submenu" + sid +",style.display = \ " none \"); //The object is set not to be displayed

}

}

& lt/SCRIPT & gt;