Arrgghh!

I’ve just spent about 20 mins looking for an error in some code. After all that I ealised I’d missed a curley brace:

function cancel(mode)
{
  if(mode == "new")
    window.location.href = 'action.php?mode=cancel-new';
  } else {
    // mode == "existing"
    window.location.href = 'action.php?mode=cancel-existing';
  }
}

instead of

function cancel(mode)
{
  if(mode == "new")
  {
    window.location.href = ‘action.php?mode=cancel-new’;
  } else {
    // mode == “existing”
    window.location.href = ‘action.php?mode=cancel-existing’;
  }
}

I think my mind must be distracted. But then I’ve been working since about 10 AM ish, so it’s been quiet a long day ;-)

Sociable:These icons link to social bookmarking sites where readers can share and discover new web pages.
  • del.icio.us
  • digg
  • Furl
  • NewsVine
  • Reddit
  • YahooMyWeb

2 Responses to “Arrgghh!

  • JimmyMac
    August 19th, 2004 12:25
    1

    One of my favourite JavaScript errors is the old semicolon directly after the condition. Never fails to leave me baffled for an hour or so… :-/

  • Paul
    November 27th, 2004 22:00
    2

    Eh. It happens; what really sucks is when you make the mistake over and over again, especially as Actionscript in a Flash document, and you have to change everything.

Leave a Reply