?? p223_domains_picklists.htm
字號:
<HTML><BODY>
<SCRIPT LANGUAGE="JavaScript">
// an object with 12 properties
var months = { 'Jan':0,'Feb':0,'Mar':0,'Apr':0,'May':0,'Jun':0,
'Jul':0,'Aug':0,'Sep':0,'Oct':0,'Nov':0,'Dec':0 };
// check for times of the day
function is_time_domain(value)
{
// the expected format is a simple Army time: 0 to 2359
// with no colon (:), so 23:59 is not allowed.
// Obviously it could be more complex.
var num = parseInt(value,10);
if (value.length != 4 )
return false;
if ( num <0 || num % 100 > 59 || num / 100 > 23)
return false;
return true;
}
// check for months of the year
function is_month_domain(value)
{
// Could be more tolerant of capitalisation.
return ( months[value] != null ); // true if it's there
}
// check for anything
function check_domain(domain, value)
{
var result = false;
if ( domain == 'TIME' ) result = is_time_domain(value);
if ( domain == 'MONTH' ) result = is_month_domain(value);
if (!result)
alert('please enter data correctly');
return result;
}
</SCRIPT>
<FORM>
<BR> Enter an Army time:
<INPUT TYPE="text" ONCHANGE="return check_domain('TIME',this.value)">
<BR> Enter a month in short format:
<INPUT TYPE="text" ONCHANGE="return check_domain('MONTH',this.value)">
</FORM>
</BODY></HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -