Monday, 2 February 2009

Being annoyed by IE and it actually snowed!

Although I went to bed at about 6.30pm last night, I didn't get to sleep until about 00.00am, and then kept waking up in the night as well. I got up about 8.45am this morning. There was maybe about 1cm of snow on the ground, so not much, but quite a lot more than there was last night. Then by about 9.30am it has started snowing again, and by 10.00am it was snowing quite heavily.

I checked my spleenmail and by 10.20am it had stopped snowing. On the radio they said that it was very snowy in the Southeast, which is typical, it always seems to snow loads where we don't live, and then if we do live there it doesn't snow much. Though of course, I wouldn't appreciate the snow if I still had to go to work.

I played on Animal for a bit, then started doing some more work on panachallengetest about 11am. By 11.30am the snow had melted a bit, but then it started snowing again, and stopped again by about 12pm.

Why is there a small Deena head next to Bud's house?

Best place for snowmen
I had lunch about 12.30pm, then played on Animal for about half an hour. After that I looked outside and it had started snowing again, although nearly of the snow on conrete/tarmac had melted.

Ben came home about 3pm, then we went in the garden about 3.30pm and played in the snow, we just made a big snowman in the back garden. Unfortunately his head fell off - that never happens in Animal Crossing. So we had to re-build his head, which took quite a while. Then I tried to take some photos of snowflakes, but was very difficult to first get a bit of snow that was a snowflake shape, then if you do find one, to get it in focus and take a photo of it before it melts. I put the MP-E at 4x magnification, but the snowflakes were still quite small in the frame.

I did some more website work, then it was dinner time. By dinner time it was quite snowy outside, and was still snowing. After dinner I played Excite truck with Mac and Ben, then we watched some of House of Flying daggers. I looked outside and though it was still snowing (though not very heavily) there was actually less snow than there was earlier. About 22.30 I looked in the back garden, it had stopped snowing and it looked like the snowman's head had melted into his body.

Some problems with website stuff I had today was that IE was not setting the name of an input element using javascript. I tried both input.setAttribute('name', 'theName'); and input.name = 'theName' but neither worked in IE. I needed to set the name as I loop through the elements in javascript (they all have name+number for their name) when doing the form verification.

The answer is that you need to create the Element in a weird way in IE (so no, you can't just clone an existing node and then change its name, which is what I was trying to do). I found the answer here: Web Bug Track bug 235 - createElement is broken in IE. So I changed my code to be like
try{el = document.createElement('<input type="text" name="myName'+i+'">');}//IE
catch(er) //Browsers that aren't broken
{
clonedNode.setAttribute('name', 'myName'+i);
el = clonedNode.cloneNode(true);
}
ElementToInsertBefore.parentNode.insertBefore(el, ElementToInsertBefore);


Finding out why it wasn't working in IE took me ages. Then another problem I had, that was relatively easy to fix, was that Safari was submitting the form even if an error occured. The answer was that I needed to call e.stopPropagation(); when an error occured. I found the answer here: Prevent the Default Action for an Event.

Another IE problem was that it didn't like it if I checked the length of a string that was 0 characters (i.e. ''). So I had to change my code so that it checked if the string evaluated to true before checking its length if(str && str.length > 64) {//do stuff}.

I think I probably had some other problems with IE as well, but I can't remember what they were now.

Food
Breakfast: Lemon marmalade toast sandwich; cup o' tea.
Lunch: Italian place style ham sandwich; apple; home-made rock cake; cup o' tea.
Dinner: Beef burger; lasagne; 2½ baked beans; green beans; potato; broccoli. Pudding was chocolate cereal cake. Coffee.
Supper: Choc chip cookie; dried mango pieces; coffee.

No comments: