Jump to content
Larry Ullman's Book Forums

rshoe

Members
  • Content Count

    2
  • Joined

  • Last visited

Everything posted by rshoe

  1. i have posted the code below. I am reading in chapter two of the Modern JavaScript book. I don't know about split. I have not read that part. Thanks; Randy function formatNames(){ 'use strict' var formattedLength; var formattedMiddle; var formattedInitials; var fullName = document.getElementById('fullName').value; formattedLength = fullName.length; formattedMiddle = fullName.slice(6,11); formattedInitials = fullName.charAt(0) + fullName.slice(7,8) + fullName.charAt(11); document.getElementById('lengthName').value = formattedLength; document.getElementById('middleName').value = formattedMiddle; document.getElementById('initials').value = formattedInitials; return false; }//Endof formatNames() functions. function init(){ 'use strict' document.getElementById('theForm').onsubmit = formatNames; }//End of init() function window.onload = init;
  2. I need some help with a project. I have a form where a person enters their full name (First Middle Last). When the full name is entered In this form it will show the length in numbers of the full name. Other sections of the form will show just the middle name and show their Initals. I Think I use the slice method but not sure how to go about applying the code. If anyone can help I would appreciate it. Thanks; Randy
×
×
  • Create New...