Feb
4
2011
If you want to enable the “placeholder” attribute of input boxes in browsers that don’t support it, simply download this file, and include it anywhere on your page. It will copy the native functionality, and disable itself in browsers that already support the attribute.
This file will require a reasonably new version of jQuery to run correctly (and yes, it works in no-conflict mode).
jQuery.placeholder.1.0.1.min
Comments, questions? Feel free to comment.
NOTE: This project has been moved into github
3 comments | posted in Javascript, usability, Web Development
Mar
5
2010
<script runat="server">
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = "301 Moved Permanently";
Response.AddHeader("Location","http://www.new-url.com");
}
</script>
no comments | tags: .Net, C#, HTML, IIS, internet, server, useful, work | posted in .Net, usability, Web Development
Jan
11
2010
//tell javascript to run a function in 1 second
setTimeout ("myFunction()", 1000 );
function myFunction(){
//do stuff
//once the function is finished, queue this function up to run again in 1 second
setTimeout ( "myFunction()", 1000 );
}
1 comment | tags: HTML, internet, Javascript, useful | posted in Javascript, Tips, usability, Web Development
Sep
12
2009
Google doesn’t make it easy to show you the latitude and longitude of an address you search in google maps, but there’s an easy way to get the info.
- go to google maps, type the address, and click search
- once you’ve found it, go to your address bar and clear what’s in it
- paste:
javascript:void(prompt('',gApplication.getMap().getCenter())); into the address bar
- use the coordinates for whatever you wish!
no comments | tags: HTML, internet, Javascript, useful, work | posted in Javascript, Tips, usability, Web Development
Jul
8
2009
So for work, the designer says “Hey, can we use this font in the webpage” and like an idiot, I say “sure, why not?”. Well, FF and Safari don’t support .otf files (for whatever reason) So I download FontForge, open it in X11 (on my mac) and convert it to .ttf, which works great.
Then I messed around in IE, trying to make it work, even downloading this tool:

Worst thing EVER. Don’t do this. Don’t get this. Don’t even look at this. You will feel violated if you use it.
So…how to embed an OTF font in a website (make sure you have a license to do so kids):
- Convert OTF file to .ttf (use fontForge)
- Embed with @font-face
- When adding the font to a style, in IE you CAN NOT call it by the name you gave it with the @font-face declaration. You have to call it by it’s name. So if the font’s name is myfontLTSTDBOLDITALICROMAN you have to do: body{ font-family: myfontLTSTDBOLDITALICROMAN; } Sucky? Very. Works? yes.
Have a nice day
3 comments | posted in Tips, usability, Web Development
May
6
2009
So, wouldn’t it be user friendly, if when you went to a form page in a document, if the cursor was automagically positioned at the first field in the form?
Why, yes it would. Try:
Event.observe(window, 'load', function(){
try {
$('eventName').focus();
}
catch (e) {}
});
after your </form> tag. This requires the prototype javascript library
no comments | tags: internet, Javascript, useful, work | posted in Javascript, Tips, usability, Web Development