navigation - javascript noob... document write -



navigation - javascript noob... document write -

i'm trying utilize javascript load more links in my nav bar.

this tried; wanted 1 link in nav load more beneath it.

<a href="" onclick="show()"/>collections</a> <script type="text/javascript"> function show() { document.write("collection 1 <br /> collection 2 <br /> etc... <br />"); } </script>

can suggest relevant tutorial or give me hint?

document.write should used while document loading. calling after document loaded clear current document , write new content. add together new content page, need create new dom objects , add together them page or modify existing dom objects.

here's little illustration of modifying page can see in action here: http://jsfiddle.net/jfriend00/zvs39/

html:

<a href="#" onclick="show()">collections</a> <span id="moretext"></span>

javascript:

function show() { var o = document.getelementbyid("moretext"); o.innerhtml = "<br>collection 1 <br /> collection 2 <br /> etc... <br />"; }

javascript navigation

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -