current position:Home>JSP related questions, seek answers

JSP related questions, seek answers

2022-02-04 17:04:15 CSDN Q & A

To write JSP page , Realize according to one's 18 One ID card shows the function of birthday , Input ID number and submit in form. , The results are shown in jsp Page table , As shown in the table . Information to be displayed on the page .
ID number Birthday
010020199601026929 1996 year 01 month 02 Japan

Who knows how to write ? I'm not very skilled yet .




Take the answer :
function getBirthdayFromIdCard (idCard) {          var birthday = "";        if(idCard != null && idCard != ""){            if(idCard.length == 15){                birthday = "19"+idCard.substr(6,6);            } else if(idCard.length == 18){                birthday = idCard.substr(6,8);            }                    birthday = birthday.replace(/(.{4})(.{2})/,"$1-$2-");        }                return birthday;      }

Put this script in your jsp In the page , Call


copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/02/202202041704087900.html

Random recommended