/*Validate Phone No*/
$('.valPhoneNo').blur(function(){
var phone = $(this).val();
phone = phone.replace(/D/g,'');
if(phone.length == 7){
var dispPhone = phone.slice(0,3) + "-" + phone.slice(3);
$(this).val(dispPhone);
} else if(phone.length == 10) {
var dispPhone = "(" + phone.slice(0,3) + ") " + phone.slice(3,6) + "-" + phone.slice(6);
$(this).val(dispPhone);
}
});
Category Archives: Web Authoring Links
Filtered by Tag: JavaScript (unfilter)
Function to prevent enter key from submitting form
// Prevent Enter key from submitting form without returning a button click
$('form[name="Save"] > input:text').bind("keypress", function(e) {
console.log('i');
var code = e.which;
if (code == 13) {
e.preventDefault();
return false;
}
})
Stop before unloading the page
Javascript: Interation through form elements
var elem = document.getElementById(‘frmNameSearch’).elements;
str = ”;
for(var i = 0; i < elem.length; i++)
{
str += “Type: ” + elem[i].type + ” Name: ” + elem[i].name + “n”;
}
console.log(str);
Binding keystrokes in jquery
This post is useful on that subject.
New PHP Project & Name Parsing
Thinking about developing a mysql database for help with case management in my firm. Learned alot by using XAMPP and the excellent PHP Development Series video tutorials at Lecture Snippets.
Jonathon Hill‘s PHP Human Name Parsing, improving Keith Beckman’s script.
Jason Priem’s page about parsing human names in PHP.
Here is the same type thing in javascript by Josh Frasier.
Another javascript name parser by Jerry Davidson.
Chris West’s blog post about javascript name parsing.
Floating Menu
I will study this javascript code for a floating div menu.
Added Javascript to home page
Added Show/Hide doodles link to home page using the javascript technique described here.