📄 myscript.js
字号:
function load() {
var year = document.all("year");
date = new Date();
with (year) {
var oOption;
for (i = 1, j = date.getYear() - 100; i <= 101; i++, j++) {
oOption = document.createElement("option");
options.add(oOption, i);
oOption.innerText = oOption.value = j;
}
oOption = options[100];
oOption.selected = true;
}
monthLoad();
dayLoad();
var day=document.all("day");
with(day)
{
var oOption = options[date.getDate()-1];
oOption.selected = true;
}
}
function yearChanged() {
var year = document.all("year");
with (year) {
if (options[selectedIndex].value == "") {
return;
}
var sAttribute = options[selectedIndex].value;
}
dayLoad();
}
function monthLoad() {
var month = document.all("month");
date = new Date();
with (month) {
var oOption;
for (i = 1; i <= 12; i++) {
oOption = document.createElement("option");
options.add(oOption, i);
oOption.innerText = oOption.value = i;
}
oOption = options[date.getMonth()];
oOption.selected = true;
}
}
function monthChanged() {
var month = document.all("month");
with (month) {
if (options[selectedIndex].value == "") {
return;
}
var sAttribute = options[selectedIndex].value;
}
dayLoad();
}
function dayLoad() {
var year = document.all("year");
var yearvalue;
with (year) {
if (options[selectedIndex].value == "") {
return;
}
yearvalue = options[selectedIndex].value;
}
var month = document.all("month");
var monthvalue;
with (month) {
if (options[selectedIndex].value == "") {
return;
}
monthvalue = options[selectedIndex].value;
}
var day = document.all("day");
date = new Date();
with (day) {
var oOption;
var dayNum;
switch (monthvalue) {
case "1":
case "3":
case "5":
case "7":
case "8":
case "10":
case "12":
dayNum = 31;
break;
case "4":
case "6":
case "9":
case "11":
dayNum = 30;
break;
case "2":
if (isLeapYear(yearvalue)) {
dayNum = 29;
} else {
dayNum = 28;
}
break;
}
with (options) {
while (length > 0) {
remove(0);
}
}
for (i = 1; i <= dayNum; i++) {
oOption = document.createElement("option");
options.add(oOption, i);
oOption.innerText = oOption.value = i;
}
}
}
function isLeapYear(year) {
y = parseInt(year);
if (y % 400 == 0 || (y % 4 == 0 && y % 100 != 0)) {
return true;
} else {
return false;
}
}
function Check() {
// alert("check()");
var userName = document.getElementById("name").value;
var password = document.getElementById("password").value;
var patrn = /^([a-z]|[A-Z]|[0-9]){6,20}$/;
if (userName.length == 0) {
alert("\u7528\u6237\u540d\u4e0d\u80fd\u4e3a\u7a7a\uff01");
window.userinfo.name.focus();
return false;
}
if (userName.length < 6 || userName.length > 20) {
alert("\u7528\u6237\u540d\u957f\u5ea6\u4e3a[6-20]");
window.userinfo.name.focus();
return false;
}
if (!patrn.exec(userName)) {
alert("\u7528\u6237\u540d\u75316-20\u4e2a\u5b57\u6bcd\u3001\u6570\u5b57\u7ec4\u6210");
window.userinfo.name.focus();
return false;
}
if (password.length == 0) {
alert("\u5bc6\u7801\u4e0d\u80fd\u4e3a\u7a7a\uff01");
window.userinfo.password.focus();
return false;
}
if (password.length < 6 || password.length > 20) {
alert("\u5bc6\u7801\u957f\u5ea6\u4e3a[6-20]");
window.userinfo.password.focus();
return false;
}
if (!patrn.exec(password)) {
alert("\u5bc6\u7801\u75316-20\u4e2a\u5b57\u6bcd\u3001\u6570\u5b57\u7ec4\u6210");
window.userinfo.password.focus();
return false;
}
return true;
}
function reloadImage(url)
{
document.userinfo.img1.src = url;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -