Note that there are some explanatory texts on larger screens.

plurals
  1. POExpand JAVASCRIPT MENU
    primarykey
    data
    text
    <p>can anyone tell me why this funcion drop's me to the top of the page ?</p> <p>any ideas how to solve this problem?</p> <p>Or any suggestion's of a better code to use? </p> <p>P.S. this is for ebay template, quite a big menu section.</p> <pre><code>&lt;script type="text/javascript"&gt; startList = function() { if (document.getElementById) { navRoot = document.getElementById("nav"); for (i=0; i&lt;navRoot.childNodes.length; i++) { node = navRoot.childNodes[i]; if (node.nodeName=="LI") { node.onclick=function() { this.className = (this.className == "on") ? "off" : "on"; } } } } } window.onload=startList; &lt;/script&gt; </code></pre> <p>I have a basic markup:</p> <pre><code>&lt;ul id="nav"&gt; &lt;li&gt;&lt;a href="#"&gt;Home &lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;About &amp;gt;&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;History &lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Team &lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Offices &lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Services &amp;gt;&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;Web Design &lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Internet Marketing &lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Hosting &lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Domain Names &lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Broadband &lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Contact Us &amp;gt;&lt;/a&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#"&gt;United Kingdom&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;France&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;USA&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Australia&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload