Archive

Archive for the ‘Javascript’ Category

IE7 – hack Internet Explorer into submission

April 7th, 2005 ramin View Comments

Anyone who's done any real xHTML/CSS design and development will tell you that IE is by far the worst browser when it comes to standards compliancy. Fed up by IE's lack of compliancy, this javascript genius decided to create a "hack" that will make IE "act" like the rest of the good 'ol compliant browsers.

The script is brilliant and the best part about it is, its absolutely transparent to the user. So if you are authoring a website and you would like to take advantage of some of that cool CSS and PNG magic that IE lacks, give IE7 (the codename for this library) a try. All you do is insert it into your document head and it will take care of the rest.

http://dean.edwards.name/IE7/

Besides the IE7 library, the author also has a number of other very cool and extremely useful javascript libraries. A lot of them are used within IE7, but can also be downloaded seperately.

http://dean.edwards.name/my/

And if that wasn't enough, there is also a handy little IE7 Favelet that will allow you IE users to view sites the way they were meant to be viewed. This favelet will apply IE7's magic to any website you are currently on.

http://dean.edwards.name/IE7/favelet.html

Categories: Javascript Tags:

Javascript Syntax Highlighting (Editable too!)

April 2nd, 2005 ramin View Comments

A few friends and I are working on a small project that allows you to access any repository (svn, cvs, etc.) from the web much like ViewCVS and WebSVN. Well, since the whole thing will be web based, I thought it would be cool to have a web based editor that acts just like any other text editor with syntax highlighting.

The problem is, most of the WYSIWYG editors out there are meant for HTML and even those don't hightlight any of your code. I always wondered how hard it would be to use javascript to parse the text within a html area and apply syntax highlighting to it on the fly by appending SPAN's with class names to do the coloring. I'm sure a similar approach is used with the regular desktop based editors.

Before I begin writing any code I always do a quick search on google to see if someone else has already done what I'm trying to do or something similar to it. I did a simple search for "javascript syntax highlighting" and found two interesting results. One was http://www.dreamprojections.com/SyntaxHighlighter/ , which uses javascript to go through your page and dynamically apply syntax highlighting to any textareas it found with certain class names. This is very handy for DISPLAYING purposes, but not for editing. The other link I found was http://helene.muze.nl/demo/ . Now this one does exactly what I want (well, almost.) The current version only highlights PHP code, but I imagine it wouldn't be too difficult to add other languages to it. Both use CSS to do their magic, so it's easy to change the colors around.

Categories: Javascript Tags:

Extending the JavaScript DOM Interfaces

April 2nd, 2005 ramin View Comments

Found this great library of commonly used DOM traversal algorithms over at Ditchnet.org. The library contains such helpful functions as, hasClassName() and getFirstAncestorByClassName. The latter one has been added to the Element object so that it can be called on any element in an object oriented fashion. For example;

var node = target.getFirstAncestorByClassName('cName');

This library is definitely something worth looking at and maybe even adding to your collection. What really interests me about this library is how similar it is to my own library. I've written many of the same functions myself, with slight variations in the function names. Maybe that's just a sign that these functions should be a part of javascript to begin with.

Categories: Javascript Tags:

Custom Checkboxes & Drag n Drop lists using the DOM

April 1st, 2005 ramin View Comments

Michael Moncur over at The Javascript Weblog has posted two new pretty interesting articles. One is concerning custom checkboxes and the other is about drag and drop sortable lists. Both use a lot of javascript and manipulating of the DOM to accomplish their goal, so I'm not sure how well they perform in different browsers/platforms.

Categories: Javascript Tags: