차가운바람님 봐주세요

· 2013-11-25 (월) 17:30:19 · 2150 · 2
예제중 Example2 에 랜덤 출력좀 도와주세요

첨부파일

|

댓글 2개

2013-11-25 (월) 17:39:39
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="author" content="Jason Chavannes" />
<title>jQuery Timer Demo</title>

<link rel="stylesheet" href="res/style.css" />
<script type="text/javascript" src="res/jquery.min.js"></script>
<script type="text/javascript" src="jquery.timer.js"></script>
<script type="text/javascript" src="res/demo.js"></script>
</head>
<body>
<script>
function getRandom(max, min) {
return Math.floor(Math.random()*(max-min)) + min;
}
$(function() {
var rand = getRandom(100,300);
$('#startTime').val(rand);

});
</script>

<h1>jQuery Timer Demo</h1>
<p>Project home: <a href="http://jchavannes.com/jquery-timer" target="_blank">http://jchavannes.com/jquery-timer</a></p>
<p><a href="res/demo.js" target="_blank">View Source</a></p>

<hr/><h3 style='margin-top:20px;'>Example 1 - Stopwatch (counts ups)</h3>
<span id="stopwatch">00:00:00</span>
<p>
<input type='button' value='Play/Pause' onclick='Example1.Timer.toggle();' />
<input type='button' value='Stop/Reset' onclick='Example1.resetStopwatch();' />
</p>
<br/>
<br/>

<h3>Example 2 - Countdown Timer</h3>
<span id="countdown">05:00:00</span>
<form id="example2form">
<input type='button' value='Play/Pause' onclick='Example2.Timer.toggle();' />
<input type='button' value='Stop/Reset' onclick='Example2.resetCountdown();' />
<input type='text' name='startTime' id='startTime' value='' style='width:30px;' />
</form>

추가된 내용은
<script>
function getRandom(max, min) {
return Math.floor(Math.random()*(max-min)) + min;
}
$(function() {
var rand = getRandom(100,300);
$('#startTime').val(rand);

});
</script>

그리고
<input type='text' name='startTime' id='startTime' value='' style='width:30px;' />
입니다
2013-11-25 (월) 17:49:19
감사합니다..
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

66,531건

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
13-11-25 조회 1,842
13-11-25 조회 2,377
13-11-25 조회 1,775
13-11-25 조회 1,927
13-11-25 조회 2,151
13-11-25 조회 1,790
13-11-25 조회 2,113
13-11-25 조회 2,211
13-11-25 조회 1,840
13-11-25 조회 2,381
13-11-25 조회 1,990
13-11-25 조회 1,809
13-11-25 조회 4,081
13-11-25 조회 1,986
13-11-25 조회 1,790
13-11-25 조회 2,067
13-11-25 조회 1,880
13-11-25 조회 1,798
13-11-25 조회 2,627
13-11-25 조회 1,826