<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Timer</title>

<script type = "text/javascript">

console.log('Begin js');

function viewContent()

{

document.write('<br/>Actually nothing to show...<br/>');

}

var timeCount = 0;

function calTime()

{

timeCount ++;

if(timeCount < 5)

{

document.write(timeCount + 'secends...<br/>');

}

else 

{

document.write('Time out !<br/>');

window.clearInterval(countTimer);

}

}

var timer = window.setTimeout('viewContent()', 5000);

var countTimer = window.setInterval('calTime()', 1000);

console.log('End js');

</script>

</head>

<body>

<h3>Timer</h3>

<p>다음내용은 5초후 공개됩니다.</p>

</body>

</html>


6-3_Timer.html


반응형

'Programming > JavaScript' 카테고리의 다른 글

[JavaScript] 6-5_history.js  (0) 2016.12.07
[JavaScript] 6-4_location.html  (0) 2016.12.07
[JavaScript] 6-2_Navitator.js  (0) 2016.12.07
[JavaScript] 6-1_BrowserControl.js  (0) 2016.12.07
[JavaScript] 6-0_BrowserControl.html  (0) 2016.12.07

+ Recent posts