java script(java脚本).doc


文档分类:IT计算机 | 页数:约19页 举报非法文档有奖
1/19
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/19
文档列表 文档介绍
java script(java脚本)
Three. Html&JavaScript&ajax part
1. determine the second date than the first date
How to use the script to determine user input string is the time format 2004-11-21 must ensure that the user input is in this format, and it is time for example, the month is not greater than 12 and so on, I also need the user to enter two, and after a previous night, only JAVASCRIPT, please help answer,,
Available here / / regex judgment to decide in advance format, and then press the field content extraction
<script type= "text/javascript" >
= function ()
{
This is to separate the / / write the JS code and HTML code, when I modify the JS, does not affect the HTML code.
("frm1").Onsubmit =
Function () {
Var D1 = ;
Var D2 = ;
If (! VerifyDate (D1)) {alert ("the first date the wrong format"); return false;}
If (! VerifyDate (D2)) {alert ("second date format is wrong"); return false;}
If (! CompareDate (D1, D2)) {alert ("second date than the first date"); return false;}
};
}
pareDate (D1, D2)
{
Var arrayD1 = ("-");
Var date1 = new Date (arrayD1[0], arrayD1[1], arrayD1[2]);
Var arrayD2 = ("-");
Var date2 = new Date (arrayD2[0], arrayD2[1], arrayD2[2]);
If (date1 > date2) return false;
Return true;
}
Function verifyDate (d)
{
Var datePattern = /^/d{4}- (0? [1-9]|1[0-2]) - (0? [1-9]|[1-2]/d|3[0-1]) /;
Return (D);
}
</script>
<form id=, "frm1", "action=", "" >
<input type= "text" name= "D1" / >
<input type= "text" name= "D2" / >
<input type= "submit" / >
</form>
2. use table to display n records, each 3 rows change color, namely 1, 2, 3 with red font, 4, 5, 6 with green font, 7, 8, 9 with red font.
<body>
<table id= "TBL" >
<tr><td>1</td></tr>
<tr><td>2</td></tr>
<tr><td>3</td></tr>
<tr><td>4</td></tr>
<tr><td>5</td></tr>
<tr><td>6</td></tr>
<tr><td>7</td></tr>
<tr><td>8</td></tr>
<tr><td>9</td></tr>
<tr><td>10</td></

java script(java脚本) 来自淘豆网m.daumloan.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数19
  • 收藏数0 收藏
  • 顶次数0
  • 上传人rjmy2261
  • 文件大小25 KB
  • 时间2017-11-18
最近更新