2015/12/23--Partial Window Object

Source: Internet
Author: User

<! DOCTYPE html>
<meta charset= "UTF-8" >
<title> part of the Window object </title>
<script type= "Text/javascript" >
Timing in an infinite loop
var c = 0;
var T;
function Timecount () {
document.getElementById ("TXT"). Value = C;
c = c+1;
t = setTimeout ("Timecount ()", 1000);
}
Timing in an infinite loop-with a stop button
var c = 0;
var T1;
function Begaincount () {
document.getElementById (' Txt1 '). Value=c
C1=c1+1
T1=settimeout ("Begaincount ()", 1000)
}
function Stopcount () {
Cleartimeout (t1);
}
A clock
function StartTime () {
var today = new Date ();
var h = today.gethours ();
var m = today.getminutes ();
var s = today.getseconds ();
m = Checktime (m);
s = checktime (s);
document.getElementById ("Txt2"). InnerHTML = H + ":" + M + ":" + S;
t = setTimeout (' StartTime () ', 500);
}
function Checktime (i) {
if (i<10) {
i = "0" + i;
}
return i;
}
Show pop-up
function Show_popup () {
var p = window.createpopup ();
var pbody = p.document.body;
Pbody.style.backgroundcolor= "Red"
Pbody.style.border= "Solid black 1px"
Pbody.innerhtml= "This is a pop-up! Click outside the pop-up to close it! "
P.show (150,150,200,50,document.body)
}

document.getElementById ("P1"). Innerhtml= "New text!";


</script>
<body onload= "StartTime ()" >
<!--in the infinite loop---
<form>
<input type= "button" value= "Start timing! "Onclick=" Timecount () ">
<input type= "text" id = "TXT" >
</form>
<p> Click on the button above and the chronograph will be timed from 0 onwards. </p>
<!--the timing in an infinite loop-with a stop button--
<form>
<input type= "button" onclick= "Begaincount ()" value= "Start timing" >
<input type= "text" id = "TXT1" >
<input type= "button" onclick= "Stopcount ()" value= "Stop Timing" >
</form>
<p> Click on the "Start timing" button above. The input box will be timed from 0 onwards. Tap stop timing to stop the timing. </p>
<!--one clock--
<div id = "TXT2" ></div>
<!--show Pop-up-->
<input type= "button" onclick= "Show_popup ()" value= "show_pop-up" >
</body>

2015/12/23--Partial Window Object

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.