mslfire wrote:lwsimon the code does not seem to work right but that's okay
Is the use of hide/show layers a good way to provide navigation for a website? (I dont like when a website has to load another page when people click a link seems redundant when most of the content does not change) [1]
I did read the 'Javascript Tutorial'. Now if I understand it correctly Dreamweaver creates the code (function) for the Javascript (MM_showHideLayers). [2]
Are functions created individually (by programmer or program) or are there also master type functions (like in php) that control different things/actions? If there are is there a list of them?[3]
The tutorial spoke of something called DOM and object orientated programing but did not cover these two terms.[4]
[1]
I revised the code so that it *should* work, but haven't tested it in a page.
[2]
showing and hiding layers can work, but it is better to change the page. The reason? Well, there are a few. First, search engines visit your site, and see only one page. Second, if a user goes to you contacts page, and bookmarks it, when they go back, they'll get the homepage again. Third, what happens when the user has javascript turned off? Or views the page from a mobile phone? How about a blind user using a screenreader? Or a user who has difficulty using a mouse, and uses the tab key on their keyboard to move from field to field?
The bottom line is this - if your page is lightweight and properly built, there should be very little delay between pageloads, as most of the information will be cached on the client's machine between requests. This is one thing to do the traditional way, with links between pages.
[3]
I'm not quite sure what you mean by this, but I'll explain what I can and see if it helps.
A function is nothing more than a block of code that is executed at a certain point. There are functions built into the objects inherent in javascript. A function that is a part of an object is called a method. An example of a method in javascript is .length(), which is a member of the Array object. You can take an array and find its length like this:
lengthOfArray = arrayVar.length
This segues into one of our next topics, object-oriented programming.
[4] Two topics on this one. The first is object-oriented programming. This is really an extensive topic, and you should probably do quite a bit of reading on the subject to get a good grasp on it. I recommend "Code Complete" by Steve McConnell for a good introduction to OOP concepts and good programming practices in general. Essentially, an object is a collection of functions (called methods) and variables.
The DOM (Document Object Model) is a collection of objects that represent a document. It starts with the document node, which (in the case of a web page) has an HTML node under it, which has a <head> node and a <body> node under that. This goes all the way down to the individual tags on the page, and the text they contain. For a visual representation of this, download Firebug for Firefox. It has a DOM browser, which gives you a good feel for what's really going on on the page.
And with that, I'm off to bed
If I've not answered something, feel free to post back and I'll have another whack at it later tonight or tomorrow.