Forwarding a Dongdong!

Source: Internet
Author: User
Tags date eval getdate join return tostring
Code:--------------------------------------------------------------------------------


<style type= "Text/css" >
Body {
Background-color: #D4D0C8;
}
. m_fieldset {
padding:0,10,5,10;
Text-align:center;
width:150px;
}
. m_legend {
Font-family:tahoma;
font-size:11px;
padding-bottom:5px;
}
. m_frameborder {
border-left:2px inset #D4D0C8;
border-top:2px inset #D4D0C8;
border-right:2px inset #FFFFFF;
border-bottom:2px inset #FFFFFF;
width:100px;
height:19px;
Background-color: #FFFFFF;
Overflow:hidden;
Text-align:right;
font-family: "Tahoma";
font-size:10px;
}
. m_arrow {
width:16px;
height:8px;
font-family: "Webdings";
font-size:7px;
line-height:2px;
padding-left:2px;
Cursor:default;
}
. m_input {
width:18px;
height:14px;
border:0px solid black;
font-family: "Tahoma";
font-size:9px;
Text-align:right;
ime-mode:disabled;
}
</style>

<script language= "JavaScript" >
Written by Cloudchen, 2004/03/15
function minute (name,fname)
{
THIS.name = name;
This.fname = FName | | "M_input";
This.timer = null;
This.fobj = null;

this.tostring = function ()
{
var objdate = new Date ();
var Sminute_common = "class=\" m_input\ "maxlength=\" 2\ "name=\" "+this.fname+" \ "onfocus=\" "+this.name+". SETFOCUSOBJ ( This) \ "Onblur=\", "+this.name+". SetTime (this) \ onkeyup=\, +this.name+. Prevent (this) \ "Onkeypress=\" if (!/[0-9]/. Test (String.fromCharCode (event.keycode)) event.keycode=0\ "onpaste=\" return false\ "ondragenter=\" return false\ "";
var Sbutton_common = "class=\" m_arrow\ "onfocus=\" This.blur () \ "Onmouseup=\" "+this.name+". Controltime () \ Disabled
var str = "";
str = "<table border=\" 0\ "cellspacing=\" 0\ "cellpadding=\" 0\ ">"
str = "<tr>"
str = "<td>"
str = "<div class=\" M_frameborder\ ">"
STR + + "<input radix=\" 24\ "value=\" "+this.formattime (Objdate.gethours ()) +" \ "+sminute_common+" ":"
STR + + "<input radix=\" 60\ "value=\" "+this.formattime (Objdate.getminutes ()) +" \ "+sminute_common+" ":"
STR + + "<input radix=\" 60\ "value=\" "+this.formattime (Objdate.getseconds ()) +" \ "+sminute_common+" > "
str = "</div>"
str = "</td>"
str = "<td>"
str = "<table border=\" 0\ "cellspacing=\" 2\ "cellpadding=\" 0\ ">"
str = "<tr><td><button id=\" "+this.fname+" _up\ "+sbutton_common+" >5</button></td> </tr> "
str = "<tr><td><button id=\" "+this.fname+" _down\ "+sbutton_common+" >6</button></td ></tr> "
str = "</table>"
str = "</td>"
str = "</tr>"
str = "</table>"
return str;
}
This.play = function ()
{
This.timer = SetInterval (this.name+ ". Playback ()", 1000);
}
This.formattime = function (stime)
{
stime = ("0" +stime);
Return Stime.substr (stime.length-2);
}
This.playback = function ()
{
var objdate = new Date ();
var arrdate = [Objdate.gethours (), Objdate.getminutes (), Objdate.getseconds ()];
var objminute = Document.getelementsbyname (this.fname);
for (Var i=0;i<objminute.length;i++)
{
Objminute[i].value = This.formattime (Arrdate[i])
}
}
this.prevent = function (obj)
{
Clearinterval (This.timer);
This.setfocusobj (obj);
var value = parseint (obj.value,10);
var radix = parseint (obj.radix,10)-1;
if (obj.value>radix| | OBJ.VALUE&LT;0)
{
Obj.value = OBJ.VALUE.SUBSTR (0,1);
}
}
This.controltime = function (cmd)
{
Event.cancelbubble = true;
if (!this.fobj) return;
Clearinterval (This.timer);
var cmd = event.srcelement.innertext== "5"? True:false;
var i = parseint (this.fobj.value,10);
var radix = parseint (this.fobj.radix,10)-1;
if (i==radix&&cmd)
{
i = 0;
}
else if (i==0&&!cmd)
{
i = radix;
}
Else
{
cmd?i++:i--;
}
This.fObj.value = This.formattime (i);
This.fObj.select ();
}
This.settime = function (obj)
{
Obj.value = This.formattime (Obj.value);
}
This.setfocusobj = function (obj)
{
Eval (this.fname+ "_up"). Disabled = eval (this.fname+ "_down"). Disabled = false;
This.fobj = obj;
}
This.gettime = function ()
{
var arrtime = new Array (2);
For (Var i=0;i<document.getelementsbyname (this.fname). length;i++)
{
Arrtime[i] = document.getelementsbyname (this.fname) [I].value;
}
Return Arrtime.join (":");
}
}
</script>


<style type= "Text/css" >
Body {
Background-color: #D4D0C8;
}
. c_fieldset {
padding:0,10,5,10;
Text-align:center;
width:180px;
}
. c_legend {
Font-family:tahoma;
font-size:11px;
padding-bottom:5px;
}
. c_frameborder {
border-left:2px inset #D4D0C8;
border-top:2px inset #D4D0C8;
border-right:2px inset #FFFFFF;
border-bottom:2px inset #FFFFFF;
Background-color: #FFFFFF;
Overflow:hidden;
font-family: "Tahoma";
font-size:10px;
width:160px;
height:120px;
}
. c_frameborder TD {
width:23px;
height:16px;
font-family: "Tahoma";
font-size:11px;
Text-align:center;
Cursor:default;
}
. C_frameborder. Selected {
Background-color: #0A246A;
width:12px;
height:12px;
Color:white;
}
. C_frameborder span {
width:12px;
height:12px;
}
. c_arrow {
width:16px;
height:8px;
font-family: "Webdings";
font-size:7px;
line-height:2px;
padding-left:2px;
Cursor:default;
}
. c_year {
font-family: "Tahoma";
font-size:11px;
Cursor:default;
width:55px;
height:19px;
}
. c_month {
width:75px;
height:20px;
font:11px "Tahoma";
}
. c_datehead {
Background-color: #808080;
Color: #D4D0C8;
}
</style>

<script language= "JavaScript" >
Written by Cloudchen, 2004/03/16
function Calendar (name,fname)
{
THIS.name = name;
This.fname = FName | | "Calendar";
This.year = new Date (). getFullYear ();
This.month = new Date (). getmonth ();
This.date = new Date (). GetDate ();
Private
this.tostring = function ()
{
var str = "";
STR + + "<table border=\" 0\ "cellspacing=\" 3\ "cellpadding=\" 0\ "onselectstart=\" return false\ ">";
STR + + "<tr>";
STR + + "<td>";
str = This.drawmonth ();
STR + + "</td>";
STR + + "&LT;TD align=\" right\ ">";
str = This.drawyear ();
STR + + "</td>";
STR + + "</tr>";
STR + + "<tr>";
STR + + "&LT;TD colspan=\" 2\ ">";
STR + + "<div class=\" C_frameborder\ ">";
STR + + "<table border=\" 0\ "cellspacing=\" 0\ "cellpadding=\" 0\ "class=\" c_datehead\ ">";
STR + + "<tr>";
str = "<td> Day </td><td> one </td><td> two </td><td> three </td><td> four </ Td><td> Five </td><td> six </td> ";
STR + + "</tr>";
STR + + "</table>";
str = this.drawdate ();
STR + + "</div>";
STR + + "</td>";
STR + + "</tr>";
STR + + "</table>";
return str;
}
Private
This.drawyear = function ()
{
var str = "";
STR + + "<table border=\" 0\ "cellspacing=\" 0\ "cellpadding=\" 0\ ">";
STR + + "<tr>";
STR + + "<td>";
str = "<input class=\" c_year\ "maxlength=\" 4\ "value=\" "+this.year+" \ "name=\" "+this.fname+" \ "id=\" "+this.fName+ "_year\" readonly> ";
Datefield
STR + + "<input type=\" hidden\ "name=\" "+this.fname+" \ "value=\" "+this.date+" \ "id=\" "+this.fname+" _date\ ">";
STR + + "</td>";
STR + + "<td>";
STR + + "<table cellspacing=\" 2\ "cellpadding=\" 0\ "border=\" 0\ ">";
STR + + "<tr>";
STR + + "<td><button class=\" c_arrow\ "onfocus=\" This.blur () \ "Onclick=\" event.cancelbubble=true; document.getElementById (' "+this.fname+" _year "). value++;" +this.name+ ". Redrawdate ()" >5</button></td> ";
STR + + "</tr>";
STR + + "<tr>";
STR + + "<td><button class=\" c_arrow\ "onfocus=\" This.blur () \ "Onclick=\" event.cancelbubble=true; document.getElementById (' "+this.fname+" _year "). value--;" +this.name+ ". Redrawdate ()" >6</button></td> ";
STR + + "</tr>";
STR + + "</table>";
STR + + "</td>";
STR + + "</tr>";
STR + + "</table>";
return str;
}
Priavate
This.drawmonth = function ()
{
var amonthname = ["One", "two", "three", "four", "five", "six", "seven", "eight", "Nine", "Ten", "11", "12"];
var str = "";
STR + + "<select class=\" c_month\ "name=\" "+this.fname+" \ "id=\" "+this.fname+" _month\ "onchange=\" "+this.name+". Redrawdate () ">";
for (Var i=0;i<amonthname.length;i++) {
STR + + "<option value=\" "+ (i+1) +" \ "+ (I==this.month?) Selected ":" ") +" > "+amonthname[i]+" month </option> ";
}
STR + + "</select>";
return str;
}
Private
This.drawdate = function ()
{
var str = "";
var fday = new Date (this.year,this.month,1). Getday ();
var fdate = 1-fday;
var lday = new Date (this.year,this.month+1,0). Getday ();
var ldate = new Date (this.year,this.month+1,0). GetDate ();
STR + + "<table border=\" 0\ "cellspacing=\" 0\ "cellpadding=\" 0\ "id=\" "+this.fname+" _datetable "+" \ ">";
for (Var i=1,j=fdate;i<7;i++)
{
STR + + "<tr>";
for (Var k=0;k<7;k++)
{
str = + "<td><span" + (j==this.date? "class=\" selected\ "" ") +" onclick=\ "" +this.name+ ". Redrawdate ( This.innertext) \ ">" + (isDate (j + +) + "</span></td>";
}
STR + + "</tr>";
}
STR + + "</table>";
return str;

function IsDate (n)
{
Return (n>=1&&n<=ldate)? N: "";
}
}
Public
This.redrawdate = function (d)
{
This.year = document.getElementById (this.fname+ "_year"). Value;
This.month = document.getElementById (this.fname+ "_month"). value-1;
This.date = d | | This.date;
document.getElementById (this.fname+ "_year"). Value = This.year;
document.getElementById (this.fname+ "_month"). SelectedIndex = This.month;
document.getElementById (this.fname+ "_date"). Value = This.date;
if (this.date>new date (this.year,this.month+1,0). GetDate ()) this.date = new Date (this.year,this.month+1,0). GetDate ();
document.getElementById (this.fname+ "_datetable"). outerHTML = This.drawdate ();
}
Public
This.getdate = function (delimiter)
{
if (!delimiter) delimiter = "/";
var avalue = [This.year, (this.month+1), this.date];
Return Avalue.join (delimiter);
}
}
</script>
<table border= "0" >
<tr><td>
<fieldset class= "C_fieldset" ><legend class= "C_legend" > Date (T) </legend>
<!--call Calendar-->
<script>
var c = new Calendar ("C");
document.write (c);
</script>
<!--call Calendar-->
</fieldset>
</td>
&LT;TD valign= "Top" >
<fieldset class= "M_fieldset" ><legend class= "M_legend" > Time (T) </legend>
<!--call time Clock-->
<script>
var m = new Minute ("M");
M.play ();
document.write (m);
</script>
<!--call time Clock-->
</fieldset>
</td></tr>
<tr>
&LT;TD colspan= "2" >
<button onclick= "alert (c.getdate ())" style= "font:8px webdings;width:15px;height:15px;line-height:6px;" >4</button>
<button style= "font:10px arial;height:15px;height:16px;border:0px; onfocus=" This.blur () ">GetDate</ Button>

<button onclick= "alert (M.gettime ())" style= "font:8px webdings;width:15px;height:15px;line-height:6px;" >4</button>
<button style= "font:10px arial;height:15px;height:16px;border:0px; onfocus=" This.blur () ">GetTime</ Button>
</td>
</tr>
</table>


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.