Friday, September 25, 2009

No-Frames Navigation System Using External JavaScript

In recent years, JavaScript has taken a siginificant evolutionary step that allows web designers to make their webpages much more interactive using a technology referred to as AJAX, which stands for "Asynchronous JavaScript and XML". We can use this technology to use JavaScript to effectively mimic the effects of Server Side Includes and PHP Includes. That is, the JavaScript in the external file "ajaxNavMenu.js" reads in an external file and writes the contents of that file into your webpage in order to generate your navigation menu.
Using this system couldn't be much easier. You just call the supporting JavaScript file in the section of your web page using the
Just change the name of the src file to the JavaScript file that generates your menu. A basic Javascript to create a navigation menu would look something like this:
document.writeln('Home
');
document.writeln('Page 1
');
document.writeln('Page 2
');

As you can see, the code to get JavaScript to write HTML can be cumbersome, and you have to watch out for quotation marks causing syntax errors. Again, this is why I prefer the version that uses AJAX.

No comments:

Post a Comment

MyUrduStuff

Search This Blog

My Urdu Stuff