ecshop注册添加手机必填简单验证

user_passport.dwt大概106行添加:

        <tr>
          <td align="right">{$lang.other_mobile_phone}</td>
          <td>
          <input name="phone" type="text" size="25" id="phone" onblur="checkPhone(this.value);"  class="inputBg"/>
            <span id="phone_notice" style="color:#FF0000"> *</span>
          </td>
        </tr>

user.js大概429行添加:

//添加手机号码验证
function checkPhone()
{
  var submit_disabled = false;
  var phone = document.getElementById("phone");
  if (phone.value.length<11)
  {
    document.getElementById('phone_notice').innerHTML = mobile_phone_invalid;
    submit_disabled = true;
  }
  else
  {
    document.getElementById('phone_notice').innerHTML = "<font color=red>- 手机号码正确</font>";
  }
  if( submit_disabled )
  {
    document.forms['formUser'].elements['Submit'].disabled = 'disabled';
    return false;
  }
}



你可能感兴趣的:(ecshop注册添加手机必填简单验证)