If you read my article on AJAX & JS yesterday, you know I hate JS with a burning fury. But I am not so crass as to just say "Don't use JS." and leave it at that. Believe it or not, there are many enough alternatives to JavaScript; at any rate, there are enough to make it possible to have a beautiful and responsive JS-free site.
In a nutshell, my biggest problem with JavaScript is that it tries to do too much, it has too much buggy code, it is largely not XHTML 1.1 compliant (don't even think about XHTML 2.0!), and almost never displays the same or even properly across the major browsers. So I'm going to try to find a viable alternative (or mix of alternatives) that will let us accomplish what we need in a way that will display on the major browsers (here taken to be IE7, Firefox 1.5, and Opera 9) in a code-compliant manner, and more importantly in a simple and bug-free shape. Starting from the most "all-in-one" solutions:
- Java Not JavaScript obviously, but just Java. The idea may seem laughable now, but was one of the most popular 'fads' back in the day to make sites entirely out of Java. And why not? After all, it is server-side script, but it runs in a JVM, which means that in an all-code environment you can modify almost anything you want, from mouse-clicks to mouse-cursors, from new windows to closing old ones; it is all possible. Don't get me wrong however. I'll make my stance on Java very clear: Only use Java to make small applications not websites or forms. It loads slow, it runs slow, and users hate it.
- Flash Almost exactly like Java, except it is used as a media presentation format rather than a programming language due to its lack of OOP and hooks. Flash applets are generally smaller than Java applets, and are more common and acceptable in the currnet time. Its usage also ranges from entire sites written in Flash (even the NSA!!) to forms, intro movies, interactive games, etc.
Both Java and Flash have the distinct advantage of displaying 100% as-is on any browser or platform with Java or Flash support. It means that every single button will be in the same exact place, it means that roll-overs will be spontaneous and pretty everywhere, and most importantly it means that the web knows no borders or operating systems.
But there is a catch (you should know that by now...)! Both Flash and Java are large, slow, and non-indexable. Skipping over slow and large in todays mostly-broadband world; it is important to realize that they are not machine readable.
Google has no idea what is on your 100% Flash or Java site, and even if you have keywords here or there, there is no content. Also, the two aren't globally appreciated. For one thing, it is remarkably harder to code a site in Flash or Java than in XHTML + CSS. End users also would rather a quick-loading site that they can search through with ctrl+f without issues, and that they can cut and paste reports from...
Flash and Java are not the ideal solutions we are looking for. Enter the year 2000 (and 6), and with it a web-revolution. Think of it as the dot-com-bust cleanup team. W3C, CSS, HTML 4.0.1, IE6, and the birth of Firefox as a true challenger.
CSS
Belive it or not, almost anything people are doing in JavaScript today can be done with CSS. But before you get too excited, you have to realize that CSS is a work in progress. Already it is by consensus the internet standard; but while W3C is moving along at break neck speeds with CSS, browsers (even the famous Firefox) are having issues catching up.
Only now has IE become CSS2 compliant with its 7th release (still in Beta), and Firefox does not yet fully support everything in CSS3 (though the fanboys will claim... :P).
Yet CSS supports end-user settings that use the browser itself to identify clicks, rollovers, etc. in a manner that is compliant with all the big names. In short CSS can be used at the moment for producing the purtiest forms on the net, complete with shading and background coloring depending on content or cursor/caret location(s).
At the moment it is not yet up to the point where it controls the browser itself though; for example, you cannot change status-bar text or make toolbar buttons disappear.. But there is a reason. CSS has done away with the useless and very much annoying features of JavaScript, and at the same time presents use with a stanards compliant method of doing the necessary stuff.
CSS can be used for roll-over effects, multi-linking and more.. But this is not a review of CSS. In short, CSS is the W3C solution for most of these issues, complete with code for display, code for content, and smart-code to replace some JavaScript.
But you almost never hear the term CSS except paired with another word: XHTML. Now that the web is no longer simply a source for hard-core information in pure text and bulleted lists (that's what newsgroups are for!) and is a thing of immense beauty and with a huge audience, the entire web is being rewritten!
The first steps were cleaning up browser specific HTML tags (flotsam and jetsam from the browser wars), and introducing HTML 4.0. After that came the HTML 4.0.1 Strict and XHTML 1.0 Transitional. These latter introductions attempted to separate code from content and to make the web a more browsable place. After being met with quite a lot of success we now have XHTML 1.0 Strict and XHTML 1.1; with XHTML 1.1 being the current lucky horse. W3C has successfully revolutionized the web, but believe it or not there is more to come.
The current XHTML 2.0 Prototype will include tags for navigation menus and other end-user 'pure aesthetics' displays, which when combined will allow us to use pure CSS and XHTML 2.0 together without any other 'helper scripts' in the middle. The horizon is clear and the time is ripe for another upgrade to the web as we know it... But even that is not all!!
XML is currently on an entirely different atrack, not truly expected to be the 'sequel' to XHTML; but if plans go right and the campaign for a cleaner cyberspace continues, expect to see pure XML-driven webpages that use different server-side scripts combined with CSS to give the web a brand new look and an impossibly beautiful and useable interface!

You do realize that JavaScript is used in other places than web pages right? you mention flash as an alternative. Well gues what? Flash also uses JavaScript. It sounds to me like you hate DHTML. The DHTML DOM is where most of the incompatibilities lie as you state when you list DHTML as an alternative to JavaScript. And guess what is you do what you call "DHTML" and make any atempt to have it run cross browser you will use JavaScript to make the HTML Dynamic.
My point here is that you are putting wy too much of the blame on JavaScript. JavaScript as a dynamic scripting language is not as bad as you make out. In fact it is pretty good. Now HTML 3.x, 4.0 XHTML CSS DOM 1,2,3 are rarely completley implemented on a single platform. That is where the problem lies. Your beef is with the browsers not with JavaSctipt. It's like saying that C is a bad language because it is hard to write cross platform GUI apps with it.
Huh, i may be kinda lost... but DHTML fundation is indeed Jscript, whatever it used on netscape or in IE at that time, it was purely and simply Jscript... or i missed something :D...
Yes, exactly. I actually was one of the first to champion DHTML (on my old and now deleted blog). I remade my site with DHTML, and then first began to dream of a JavaScript free world... Which is exactly why I did not include DHTML as a final alternative in the last bit after the bullets....
@Anonymous: AFAIK Flash uses specially selected JS that works with its internal 'browser' so to speak. I like DHTML... but I don't like the fact that it uses JS.
I guess JS is OK to do something real fast, but to make a webpage built on a JS backbone?! That is like building a house on foundations of PlayDough!
Personally I think you need to get some light reading in about Javascript/DHTML, the way the java runtime you're using determines potential problems, and how different browsers handle these items differently as well. You seem a bit confused about it all. Then you should revisit this "article" and fix all of the very obvious errors.
Also... DHTML == Javascript. They're synonimous. There is no difference. DHTML == Javascript(used to dynamically adjust element properties/attributes values).
Technically there are differences between the Java Runtime and Flash plugins for different platforms/browsers. For example, Flash on a Fedora Core runs faster than on Windows (especially noticeable while playing games), and when referencing browser properties in Java, you need to specify certain different parameters for different platforms, etc. but they are as close as you will ever get to a universal solution; these quirks are because of how the plugin/JVM was engineered itself.
IMHO DHTML was a failed attempt at refining JavaScript. It made it more browser-specific but slightly more useable.. And DHTML can technically be used without JS. I updated the bit about DHTML though.. Thanks for clearing that bit up however...
I think the chief problem with JavaScript is that there is no single definitive interpretor. You have the ECMAScript standard and then you have "hacks" that both Microsoft and Netscape have added. This is a problem in C/C++, too, but with those languages you usually don't have to worry about writting code that is cross-compiler compliant.
Of course, CSS has the same problem, heh.
Anyway, I'm currious what your thoughts on DOM Scripting are. As this page suggests, it's a bit different than just plain DHTML.
goes off reading the other posts :)
In a nutshell? My problem is more with Flashy JavaScript (which I now know to call DHTML :P) than with DOM "inline" scripting. The reason is very simple: its harder to implement, and used less often. I think it is being used by people how know how to make more-or-less compatible and bug-free code and stuff; also it is hard to overuse since it doesn't strike you the minute you see the sight, in the way that AJAX and DHTML do... which is less of an incentive for JS-fanboys to use it.
But the thing is, I don't see the need for most DOM scripted sites/applications. In most (if not all) cases AFAIK DOM can be replaced with two lines of PHP (which I don't know...) or a line of ASP.NET (which I do know :D)
I think I'll blog about it after doing more research.. Thanks yawnmoth!
JavaScript Rocks!
another dumbass article
CSS is no substitute for Javascript (ECMA script)
how sad your ignorance...
No Jon, it isn't. But CSS is a substitute for much of what is abused in JavaScript. JS is useful, but overused - and in many places CSS should be used instead (hover triggers?).
Cant PHP be used as an replacement for some of the Javascript? Just curious.
It is true that some former uses of Javascript have since been hardcoded into HTML or CSS. Of course you shouldn't script a mouseover (and much less Java or Flash it, as was done back in the Dark Ages) if all it takes is a CSS pseudoclass. But there will always be a need for custom scripts. You still need them even for such basic things as making things fade, move or blend. I don't see the scriptaculous stuff (which is very basic) going into W3C specifications any time soon. It would sure be nice to have AJAX without the J (something like DOM elements as link targets) - but until that is widely implemented, we're stuck with Javascript for that purpose.
In the meantime, just write standards compliant, modularized, gently degrading Javascript. It can be done.
What I don't get at all is your ambition to replace client-side by server-side. It's all the contrary: everything that doesn't need new data from the server should be done client-side. You don't want people to wait 10 seconds for the site menu to fold out just because you chose to do that server-side.
How is DHTML more browser-specific? Only if you care about browser-specific extensions. Just leave them aside. There are standards, and browsers have to adapt to standards, not vice versa.
Yes, there are better and more modern languages. They don't include BASIC though.
Computer Guru wrote: "Belive it or not, almost anything people are doing in JavaScript today can be done with CSS." Wow, you sir are definitely a computer guru.