我怎么能用js制作我的导航栏

时间:2013-02-28 22:52:08

标签: javascript html nav navbar

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

<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;

 }

}

然后我需要它来制作导航栏, 顺便说一下,我也需要帮助身体上传功能:p,请帮忙

1 个答案:

答案 0 :(得分:0)

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

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

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