Archive for the ‘JavaScript’ Category

FireFox bug with onreadystatechange

Saturday, May 24th, 2008

Just ran into this bug in FireFox: Basically, if you do a synchronous call on an XMLHttpRequest object, the onreadystatechange function is not called. So the following code doesn’t work.

var request = new XMLHttpRequest();
request.onreadystatechange = function () {
if (request.readyState == 4)
  if (request.status == 200) alert('request successful')
};"GET", "/index.html", false); /* the false here makes it synchronous *


IE vs FireFox: Using JavaScript to modify attributes

Saturday, April 19th, 2008

I was working on an interesting little project involving the Google Website Optimizer and ran into this little gem.

The task was to use JavaScript to rewrite a page that was formatted using tables and was sometimes missing a row that spanned the whole table. Now I have to admit that I am not a JS or DOM pro, But I’ve picked up though some experience through this and a couple other tasks. So here is the base HTML: (more…)