Thursday, March 23, 2006

XHTML goodness

Today, I was playing with a bit of DHTML with both Firefox and IE6.
At some point I added an XHTML doctype to make IE observe CSS a little better.
Suddenly, the script dies in Firefox.
error in parsing value for property 'left'. Declaration dropped.
This occures in the javascript that was reading and writing the left style property of an element.
The solution was multipronged.
First, everywhere I was setting the left style property, I needed to ensure that the number was followed with px.
Thus, elem.style.left = foo; gets replaced with
elem.style.left = foo + "px";

Next, when finding elements by tag name, change to lower case.
var items = elem.getElementsByTagName("LI");
get replaced with
var items = elem.getElementsByTagName("li");

And finally, of course, ensure the document is valid XHMTL.

Googling found many people with this or a similar problem but, no solutions.

BTW, add the doctype header really made Firefox and IE6 treat CSS almost the same.
PUBLIC
"-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">


Update:
Just an interesting note to add.
The tagName property of a node still returns uppercase.

permalink
Links to this post
0 comments

Wednesday, March 22, 2006

Logging user activity with javascript

I've scribbled up an old article on logging with javascript.
Comments can be added here.

Paul

permalink
Links to this post
0 comments

FTP Shell script

This post is just to collect comments and feedback on the FTP shell script at:
http://willcode4beer.com/tips.jsp?set=bashftp

I notice that the majority of visitors are from Brazil, France, Germany, Italy, Romania, Tawain, and the United Kingdom. So, I am sure the first improvement will be just to translate the page.

I would appreciate hearing about experiences, successes and failures.
Thanks,
Paul

permalink
Links to this post
27 comments