JavaScript – Auto Set Focus When Page is Done Loading

I use this block of code quite often. Almost every project I develop has a login page and I always toss this in to give it that subtle boost to the overall user experience. Once the page has loaded, the cursor location will automatically be set to the username field so the user doesn’t [...]

Tags: , , , , ,

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS
read comments

PHP – Auto Convert URLs to Links in a Block of Text

Whether you’re creating your own custom blog, tweaking a CMS or building a plugin this is one block of code that can come in very handy. I’ve used this many times over the years and it has always served me well. I will admit, I am terrible with regular expressions and found this [...]

Tags: , , , ,

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS
read comments

JavaScript – Creating Default Arguments

I ran into an interesting quirk with JavaScript yesterday, one I’m surprised I hadn’t noticed before.  JavaScript does not allow you to give arguments default values when defining functions.  So after a bit of tinkering, I came up with a solution.

function lorum(x, y) {

if(typeof(x) == "undefined") {
x = 100;
}
if(typeof(y) == "undefined") {
y = 500;
}

// …
}

Of [...]

Tags: , , ,

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS
read comments
 Page 3 of 8 « 1  2  3  4  5 » ...  Last »