TroyGrosfield.com TroyGrosfield.com

Posts Tagged ‘javascript’

Headline

Preventing Character Input Using Javascript

Author
by Troy Grosfield
Date
December 1st, 2010
Category
Developer
Story

The objective here is to prevent a user from typing a specific character in a textbox. This can be accomplished with only a few lines of Javascript. Html Here we create a simple form with a single textbox: <form action=”#”> <input type=”text” /> </form> Javascript Now we add the Javascript to prevent characters from being … read more

Tags
Comments
2 Comments »
Headline

Progressive Enhancement for Web Design

Author
by Troy Grosfield
Date
October 26th, 2010
Category
Developer
Story

If you’re into web development you’ve likely come across the term progressive enhancement. But what does this really mean? Progressive enhancement is a strategy for web design that emphasizes accessibility, semantic HTML markup, and external stylesheet and scripting technologies. Progressive enhancement uses web technologies in a layered fashion that allows everyone to access the basic … read more

Tags
Comments
No Comments »
Headline

Include Images in Your Twitter Widget

Author
by Troy Grosfield
Date
October 13th, 2010
Category
Developer
Story

Update: This script to pull images into the widget no longer works.  Twitter started returning all links including images as a shortened twitter http://t.co url which just redirects to the actual resource.  The bad part about this is you can’t tell if the link is truly an image or not and you can’t reference an … read more

Tags
Comments
9 Comments »
Headline

Encapsulation, Namespacing, and Object Oriented Javascript

Author
by Troy Grosfield
Date
September 15th, 2010
Category
Developer
Story

Global functions and/or variables in Javascript can be very bad at times especially when there are many people working on a single project. In order to prevent naming collisions it’s a good idea to namespace your Javascript functions and variables and focus on encapsulation when needed. Issue Lets say you have multiple Javascript files: common.js … read more

Tags
Comments
3 Comments »
Headline

Javascript and a Link’s Onclick Event

Author
by Troy Grosfield
Date
September 14th, 2010
Category
Developer
Story

I was given the task of making a link appear selected once it was clicked. This needed to be done with Javascript so I thought I would share this easy snippet. Demo Zoom (click link to see in action): Past 7 days Past 30 days Past 3 months Past 6 months Past year You clicked: … read more

Tags
Comments
No Comments »