For years I've been reading, building and testing, mainly testing, reinventing, testing, while trying to create a flexible all in one website system. So I probably got some tricks up my sleave.

You just need to ask the right question, to get the right answer...

javascript, js & css & xhtml reference & examples

How to change the innerHTML of an iframe?

In case you have this named HTML iframe call the iframe document, and go further,...
or

You cannot change the innerHTML of the iframe document if the website-page is not on the same domain, due to security ofcuz.

How do I execute a function upon selecting an option?

On drop, on select, on changing the selected HTML SELECT box option. Just use the onchange event listener.

Select color:

How do I know which option is selected, and use the content as a function input value?

You can ask for the selectedIndex of a select. Use this to pinpoint the option of which you will use the innerHTML value.

How to transform a string to an int, integer?

So you can do calculations with that string, which is in fact the string value of an integer.

Use the parseFloat() function like this:

Can you show me some AJAX?

What is ajax in my opinion? A set of techniques for doing things live in your website page, making it act as a program "GUI". Without ajax the website template would reload upon every click on a link/button.

I'm an old-schooler who uses iframes instead of http-xml-requests. Why? First of all, iframe support is more wide-spread. Also because you are still able to use the "back"-button of your browser,...(this last one will probably become irrelevant in the future).

This is the website GUI with a hidden iframe, index.htm

So, upon clicking, do the ajax stuff AND "return false", meaning: "do not follow link". UH??? Indeed, the doAjax function will set the iframe source. Otherwise the link would open in the same window.

You probably think, "ah ok, but why not set target="theiframe"? Nope because you don't want an "iframe website"; you want a normal website of multiple pages that could also be used when javascript-support, doing the ajax, is not at hand.

So how will the website(system) look like. You'll need one GUI page: the over the top home template with css styling and javascript functions.
The other pages of your website are on the other hand very very basic templates, messages carrying only content, no cluther.

These subpages also carry their needed functions, or are able to fire functions of the "parent window" GUI template, that are not only able to change the content of some of the GUI blocks, but also change stylesheet references for instance, or load a flash movie,...

This is the "newpage.htm" answer.

This is the page that is loaded into the iframe, thus having a "parent window". So when this page is loaded (read: when the message is received), it calls the test function of his parent window, the GUI.

Click here to see it in action.

What is next? Making it more and more fancy, like for instance adding a "loading...." notice. Just change the ajax functions.



More

  1. How to remove the dotted selection border on links?
  2. With which styling rules do you start your sheets?
  3. Is there a shorter way of writing document.getElementById('nodename')?
  4. How can I protect my site/email against spam?

more small tips & tricks to come !!!