Simple Javascript Form Field Validation

Quick Regex form validation to check if a field contains numbers only...

JavaScript:
  1. function isNumeric(elem, msg){
  2. var alphaExp = /^<strong>[0-9]</strong>+$/;
  3. if(elem.value.match(alphaExp)){
  4. return true;
  5. }else{
  6. alert(msg);
  7. elem.focus();
  8. return false;
  9. }
  10. }

Read the rest of this entry »

Simple Javascript Delete Confirmation

Put this in between the tags...

JavaScript:
  1. function confirmDelete(delUrl) {
  2. if (confirm("Are you sure you want to delete this item?")) {
  3. document.location = delUrl;
  4. }
  5. }

Read the rest of this entry »