-1

好的,所以我有一个导航栏,现在我想在它加载页面时创建它,它会构建导航栏

<div id="nav">
    <div id="nav_holder">

        <ul>
            <li class="first"><a href="../index.html"> Home </a> </li>
            <li><a href="../Rules.html">Rules </a> </li>
            <ul class="drop">
                <li><a href="../help/Help.html">Help</a>
                    <ul class="drop">
                        <li><a href="../help/Beginnen.html">Beginnen</a></li>
                        <li><a href="../help/Verdienen.html">Geld Verdienen</a></li>
                        <li><a href="../help/Gebieden.html">Protection Blocks</a></li>
                        <li><a href="../help/Signs.html">Trade Signs</a></li>
                        <li><a href="../help/Sign beveiliging.html">Sign beveiliging</a></li>
                        <li><a href="../help/Item.html">Item ID List</a></li>
                    </ul>
                </li>
            </ul></li>
            <li><a href="../Doneer.html">Donate </a> </li>
            <ul class="drop">
                <li><a href="../staff/Staff.html">Staff</a>
                    <ul class="drop">
                        <li><a href="../staff/Staff.html">Faircraft team</a></li>
                        <li><a href="../staff/Solliciteer.html">Solliciteren</a></li>
                    </ul>
                </li>
            </ul></li>
            <li><a href="../Videos.html">Videos </a> </li>
            <li></li>
            <li><a href="http://fair-craft.nl/forum/index.php">Forum </a> </li>

        </ul>

        <ul class="right">
            <li class="first"><a href="forum/ucp.php?mode=register&sid=b766e6a744490a46eef80d4b9a43458a">Sign Up! </a> </li>
        </ul>

    </div>
</div>

所以我想我需要这段代码

 function holder()
 { // check if adding 1 exceeds number of pics in array
 var build='<img border="0" src="'+picArray[picCount]+'" width="649">\n';
 document.getElementById("nav_holder").innerHTML=build;

 }

}

但后来我需要它来制作导航栏,顺便说一句,我也需要关于 body onload 功能的帮助:p,请帮忙

4

1 回答 1

0

而不是 window.onload,请尝试使用jQuery http://jquery.com/

$(document).ready(function(){
  // build menu
)};

这将在 DOM 完成加载时执行。

于 2013-02-28T23:05:32.567 回答