|Written by Alex Armstrong|
|Wednesday, 23 September 2009|
Page 1 of 4
There are so many different technologies available for building web pages that it’s difficult to know what to use. Most of the approaches seem very complex and you have to spend a long time learning new languages, techniques and configuration options.
Say no to HTML
The key idea in Spartan Ajax is to avoid using HTML and do as much as possible in code. This simplifies what you are doing because there is no artificial split into “markup” and procedural language. All of the code that makes the page work is in one place and you can treat the whole thing like a desktop application.
Before getting started it’s important to understand the problem we are trying to solve. Spartan Ajax’s motto is “no more HTML” but this is a little extreme.
HTML is great if all you want to do is produce a page with lots of text, picture and links. However, if you are trying to produce a page that is more like a desktop application then HTML is a disaster area that forces you to manage the multiple technologies and make them work together.
This is the only HTML page we need and you should create it and save it under the name demo.html or demo.htm in a suitable folder. The page simply loads two scripts – Sparta.js which contains the standard object code that we are going to develope and use and demo1.js which makes use of it.
Let’s take a simple example and wrap a button:
This new button class is entered into the Sparta.js file and in the demo.js file we can make use of it with code something like:
What could be easier?
|Last Updated ( Wednesday, 23 September 2009 )|