我正在学习 JavaScript,并计划制作一个 Chrome 扩展程序。我正在制作一个年龄计算器。我已经开发了一些代码。我被困在如何在外部 JavaScript 文件中使用 jQuery?
if (ageYears > 0) {
document.write(ageYears +" year");
if (ageYears > 1) document.write("s");
if ((ageMonths > 0)||(ageDays > 0)) document.write(", ");
}
if (ageMonths > 0) {
document.write(ageMonths +" month");
if (ageMonths > 1) document.write("s");
if (ageDays > 0) document.write(", ");
}
if (ageDays > 0) {
document.write(ageDays +" day");
if (ageDays > 1) document.write("s");
}
清单.json
{
"name": "Age Calculator",
"description": "This application gives you a calculation of how old are you today, since the day you were born.",
"version": "0.1",
"manifest_version": 2,
"app": {
"background": {
"scripts": ["background.js"]
}
},
"icons": { "128": "calendar-128.png" }
"author" : "Miral Kumbhani"
}