I’m new to javascript and most of my scripts/functions have been cribbed and hacked from other sources. While this generally allows me to put together an appropriate web page, it does leave me lacking in understanding.
I’m working on a menu for my portfolio (student work). This menu is circular in layout based on how many divs are inside a parent div with the id of ‘circle’ and the first function that runs at window.onload is called ‘layout’. Some of these divs are just basic links, while others are images which I would like to use with a lightbox script. The lightbox needs to load at window.onload or body onload, but I can’t seem to load my layout function with any other functions either one after the other (separated by semi-colons) or inside another function like ‘init’ for example. Also, I can only seem to run this ‘layout’ function from window.onload and not just onload inside the body tag.
I’m hoping someone can explain to me why.
Here’s the code for my layout function:
[CODE]
function layout()
{
var circle = document.getElementById(‘circle’)
var circleList = circle.getElementsByTagName(‘DIV’)
layoutCircle(circle,xRadius,yRadius,rotation)
}
and here is how I am presently calling it (in between SCRIPT tags on the main web page):
[code]
window.onload = layout;
‘layout’ is a function contained inside a script file called ‘my_circle_layout.js’ and it is sourced in the header prior to the script block calling window.onload:
[code]
<script src=”js/my_circle_layout.js” type=”text/javascript”></script>
Any help would be appreciated.