View Full Version : explanation about anylink drop down menu scripts

03-27-2006, 09:57 AM
I have read the scripts,but have had some questions:
(1) It is difficult for me to understand the menu's positioning.
(2) What role does the function dynamichide(e) play in the scripts?
(3) What role does role the expression "document.write('<div id="dropmenudiv" style="visibility:hidden;width:'+menuwidth+';background-color:'+menubgcolor+'" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')" play?

Can you help me?

03-27-2006, 09:59 AM
document.write WRITES... prints, types, outputs, whatever, that stuff in the parentheses onto the page.

don't know too much more about JS myself... but it'll help to link to the (or one example) script you're talking about.

03-27-2006, 04:31 PM
There are at least three variations on anylink, each may have peculiarities of positioning but, the original tends to be the simplest acting, for the most part, like one huge element, like an image or a division.

If memory serves dynamichide(e) sets in motion the closing (hiding) of drop downs in such a manner so as to be interrupted if the mouse pointer subsequently travels over either the drop down itself or back over its trigger.

Member djr33 got the part about document.write pretty well. To be a bit more specific, it writes the designated HTML to the page at the spot in the flow of the page that, according to the script, it logically falls. Usually, this is where the script is. The primary difference between document.write and simply hard coding normal HTML into the page is that one can include variables that get resolved to their set values as the code is parsed (read) by the browser. It should be noted that document.write executes as the page is loading, just like normal HTML but, if one tries to execute it after the page has loaded, it will overwrite (replace) the entire page.