Javascript to stop IE from closing

July 22, 2008

I have a project at work where we’re looking to present a user with an edit message if they’ve changed anything within a web page and haven’t saved the form before closing the page to stop them from losing changes.  The following example works with IE 6 (which is our corporate browser).  It does not seem to work with firefox, and I haven’t checked with any other browser since our need is isolated to IE.

<html>
<body>
<script type=”text/javascript”>
document.write(“Hello World!”);
var needToConfirm = false;
//Call this function if some changes is made to the web page and requires an alert
//you could call this is Keypress event of a text box or so…
function setDirtyFlag()
{
needToConfirm = true;
}

//this could be called when save button is clicked
function releaseDirtyFlag()
{
needToConfirm = false; //Call this function if dosent requires an alert.
}
window.onbeforeunload = confirmExit;
function confirmExit()
{
if (needToConfirm)
return “You have attempted to leave this page. If you have made any changes to the fields without clicking the Save button, your changes will be lost. Are you sure you want to exit this page?”;
}
</script>
</body>
</html>


A’s Come From Behind to Win!

April 27, 2008

The game was back and forth for a while. Then in the top of the last inning, the Braves scored 8 runs to go ahead 23-16. The A’s determined not to give up answered with 8 runs of their own to win the game.  It was a great come from behind victory to end an exciting game.


Chin vs. Toilet…Toilet Wins

April 26, 2008

We’ve heard blood curling screams following a big loud crash enough from the boys that we don’t tend to overreact anymore, but something in the scream this morning sounded a little more convincing. All three boys have been wearing their brand new Crocs around the house which they tend to do when they get new clothes or shoes. Tooling around in nothing but underwear and Crocs is a sight to behold.

So we’re eating breakfast, and Jake gets up to go to the bathroom. He takes off down the hall like he just broke through a gaping hole off-tackle and somewhere in between juking the wall and stiff-arming the door, his Croc stuck to the floor and he got tripped up and and landed chin first on top of the toilet. Loud crash followed immediately by horrific scream.

I wish I took the picture anyway, but he wasn’t interested in documenting the gash for posterity. It was the shape of a football and as deep a wound as I’ve ever seen. I’m pretty sure I could see his chin bone through the blood. After sending Braden and Logan to the neighbor’s to play, we took a trip to the emergency room. An hour and a half and 9 stitches later, we’re back to getting ready for our baseball game.

This isn’t the first time we’ve had issues where running with Crocs on has produced a boy-on-floor scenario, but is the first time where a toilet got in the way. I guess toilets are a lot like middle linebackers – you’re better off avoiding them than trying to take them head on.


Blog Update

April 2, 2008

March 4, 2007 – April 1, 2008.  A little over a year between blog posts.  What happened to 2007?  I plan to fill in some blanks in between in subsequent blog posts as I get time.


Baseball Season Opens for the A’s

April 2, 2008

<Update Friday 4/4>: I’ve uploaded the practice/game schedule.  Click here to view.

What a hectic day. With Tasha gone on business until Wednesday night, it was another day to play Mr. Mom. These days just fly when there’s stuff to do. We had our first baseball practice tonight at 4:30. That was just early enough to rush us through after-school snacks and get half of our homework done and make it a sprint after practice to finish homework, eat, read, nebulize, and play DS before bedtime. Practice was good though. The boys had fun. Their coach seems nice. He stressed having fun and seemed to be very good with the kids. We’re looking forward to a good season.
The 2008 Baird baseball roster:

Logan – #6
Braden – #1
Jake – #5


I am a proud Wii owner!

March 4, 2007

Ok I admit it, I am weak. I caved in to the hype. After getting the boys a Gamecube for their birthday in December which I had planned on riding out for a while until the Wiis became more widely available, I decided there’s no time like the present. I just got sucked into the hype. Every article I read about the Wii touts the revolutionary game play. You can’t find them in stores. I have been casually watching Best Buy and Target and just kept seeing empty shelves. Yesterday while I was catching up on my RSS feeds, I came across an article/rumor that Target had been hoarding their stock and was releasing them this morning. It seemed legit as there were numerous responses verifying the claim. So I called our local Target, and sure enough, they admitted that they would be handing out tickets at 7am, 1 hour before the store opens. That little nugget festered in my mind all night.

We had a dinner party with some friends and I kept reminding myself not to drink too much wine so I could get up in the morning and go stand in line. I was in bed by 12am and had the alarm set for 5am. As I drifted in and out of an extremely restless sleep, I found myself arguing the practicality of buying one now. We just got the Gamecube and hadn’t planned for the $350 investment. Do we really need it? Of course not. At one point around 3:30am, I finally talked myself out of it and shut off my alarm, intending to sleep until 7:30am when the boys wake up. Not surprisingly, I looked at the clock at exactly 5:00am and heard Tasha ask ‘Are you getting up?’. I thought it over for all of 2 seconds and found myself mindlessly walking into the closet and reaching for the underarmor, since it is only 15 degrees. So much for practicality.

I arrived in the Target parking lot at 5:30am expecting to at least see some cars. There were about 8 cars all empty, presumably workers prepping the store for the day. I was a little surprised, but since I evidently had some time I drove back to the local Dunkin’s for some munchkins and hot tea. Might as well have breakfast while I sit and wait. Here’s a recommendation – when you order munchkins, order the number of munchkins you want, not the number of boxes. I said I wanted 2 boxes, which I thought would be 50 munchkins (25 per box per the menu). I received 2 boxes of 50 and paid double what I intended. At least I have a treat for work tomorrow.

Here’s a breakdown of the rest of my morning, which I must say isn’t at all what I expected:

6:15am – arrived back at the parking lot, which was still basically empty.

6:20am – some guy drove up, looked at the doors, and drove away

6:30am – one guy drives up, parks, gets our of his car and goes and stands “in line”…alone.

6:47am – an old lady drives up and parks in front of me. She proceeds to wait in her car. The line guy is still all by himself. He looks cold.

7:00am – no tickets are being handed out by the Target staff. Hmmm…the line is still 1 cold person long.

7:25am – the old lady leaves, stopping to talk to the line guy. She grumbles something about how rude it is to tell people one thing and not follow through and drives off.

7:40am – another guy drives up, parks, and goes to stand in line to keep the other guy company. They both look cold. At this point I have played about 57 hands of Texas Hold’em on my blackberry in my nice warm car.

7:42am – one more car parks. A woman gets out and gets in line. I decide that 5 is a quorum so I put on my gloves and go stand in line. One of the guys is from Decalb. He works at a Target there and says that this is the only one in the area that has Wiis. Supposedly they have 25 here, so we should be all good. I feel like such a loser standing in front of Target in 15 degree weather with 4 other drones waiting in line to spend money on a game system I don’t really need.

8:00am – there are now about 10 people in line when the store opens. I am cold and tired and more than a little disturbed that I could have slept until 7:45 and still been in line in time to get a Wii.

8:15am – I walk out of the Target with my new Wii and one extra controller wondering if I should have gotten 2 more so we all can play and maybe that new Zelda game on top of it. I am a trustworthy consumer.

I tried to fight it, but in the end the hype that is making the Wii the ultimate gaming console was just too much for me to overcome. I have been assimilated.