1. 首页 > 宝宝起名

专业为宝宝取名测分

如果您正在为您的宝宝寻找一个有意义和吉祥的名字,那么您来对地方了。我们的专业起名工具将帮助您找到一个完美的、评分很高的名字,符合您的个人喜好和期望。

如何使用此工具

  1. 在下面的文本框中输入您的宝宝姓氏。
  2. 从下拉菜单中选择您的宝宝性别。
  3. 输入一个您喜欢的名字,或使用我们的自动生成功能生成一个建议的名字。
  4. 单击“评分”按钮以获取您的名字分数。

您的名字得分是:

吉祥解释:

const surnameInput = document.getElementById("surname");const genderInput = document.getElementById("gender");const nameInput = document.getElementById("name");const generateNameButton = document.getElementById("generate-name");const scoreNameButton = document.getElementById("score-name");const result = document.getElementById("result");const scoreSpan = document.getElementById("score");const explanationList = document.getElementById("explanation");// 自动生成名字generateNameButton.addEventListener("click", () => {const gender = genderInput.value;const names = gender === "boy" ? ["天", "宇", "浩", "文", "杰"] : ["雅", "静", "慧", "丽","娜"];const surname = surnameInput.value;const randomName = names[Math.floor(Math.random() names.length)];nameInput.value = surname + randomName;});// 评分scoreNameButton.addEventListener("click", () => {const surname = surnameInput.value;const gender = genderInput.value;const name = nameInput.value;// 计算名字笔画const strokes = getStrokes(name);// 根据性别和笔画计算分数let score = 0;if (gender === "boy") {score += (strokes % 10) 3;score += (strokes % 12) 2;score += (strokes % 13) 1;} else {score += (strokes % 10) 2;score += (strokes % 12) 1;score += (strokes % 13) 3;}// 根据分数生成吉祥解释const explanation = getExplanation(score);// 显示结果result.style.display = "block";scoreSpan.innerText = score;explanationList.innerHTML = "";explanation.forEach((item) => {const li = document.createElement("li");li.innerText = item;explanationList.appendChild(li);});});// 计算名字笔画function getStrokes(name) {let strokes = 0;for (let i = 0; i < name.length; i++) {strokes += getStrokeCount(name[i]);}return strokes;}// 根据汉字获取笔画数function getStrokeCount(char) {const strokesTable = {"一": 1,"丁": 2,"七": 3,"长": 4,"万": 5,"六": 6,"日": 7,"月": 8,"山": 9,"川": 10,
"工": 11,"己": 12,"已": 13,"巳": 14,"巾": 15,"干": 16,"廾": 17,"弋": 18,"弓": 19,"才": 20,"丑": 21,"丐": 22,"不": 23,"专": 24,"且": 25,"世": 26,"卜": 27,"朱": 28,"为": 29,"礼": 30,"社": 31,"勿": 32,"用": 33,"甩": 34,"贝": 35,"车": 36,"共": 37,"车": 38,"生": 39,"用": 40,"田": 41,"由": 42,"甲": 43,"申": 44,"电": 45,"男": 46,"甸": 47,"画": 48,"畅": 49,"界": 50,"圭": 51,"首": 52,"卅": 53,"杂": 54,"且": 55,"乡": 56,"国": 57,"团": 58,"地": 59,"圆": 60,"园": 61,"困": 62,"囱": 63,"囲": 64,"巨": 65,"昌": 66,"广": 67,"庄": 68,"庆": 6