Archive for the 'Javascript' Category

Formatting percentages with Javascript

June 27th, 2008

My current project has several pages where I need to grab values from textboxes, calculate a percentage, and then display the percentage in a label.  So I needed to write a Javascript function to do that.
As always, I relied on Google, as I’m not a Javascript expert, and find it easier to start with other [...]

Correct for 2-digit date entry in Javascript

March 27th, 2008

In working with the function described in the last post, I realized that I needed some way to correct the year when a user entered a 2-digit year as opposed to a 4-digit year. This is because Javascript interprets ‘3/1/09′ as ‘March 1, 1909′ — throwing off my calculations quite alarmingly. There are [...]

Get the difference between two dates with Javascript

March 25th, 2008

This is nothing earthshaking; in fact, it’s almost a complete rip off of another blog post, where I initially found what I needed. But I thought I’d put it here, so it would be easier for me to find it again when I need it again:-)
function daysDiff(dayStart, daySubtract)
{
//if either date is empty, return empty string
if [...]

Dynamically change Master Page body tag

December 19th, 2007

Today I spent several hours butting up against this, and finally, after much gnashing of teeth, found this great blog entry explaining what I needed to know.
Basically, the problem is that I needed to call a javascript function onload in the body tag of the page, but of course in an ASP.NET Content page there [...]

Fire javascript onchange event programmatically

September 24th, 2007

Recently I was working on a project where I needed to tally a bunch of textbox values using javascript. The textboxes were in a table with 3 columns and about 14 rows. The far column and the bottom row were readonly textboxes used to total the various rows and columns. I [...]