차가운바람님 봐주세요

예제중 Example2 에 랜덤 출력좀 도와주세요

첨부파일

|

댓글 2개

<!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;' />
입니다
감사합니다..
댓글을 작성하시려면 로그인이 필요합니다.

그누4 질문답변

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

+
제목 글쓴이 날짜 조회
12년 전 조회 1,675
12년 전 조회 2,039
12년 전 조회 1,803
12년 전 조회 1,708
12년 전 조회 1,680
12년 전 조회 1,701
12년 전 조회 2,231
12년 전 조회 1,615
12년 전 조회 1,767
12년 전 조회 1,991
12년 전 조회 1,633
12년 전 조회 1,974
12년 전 조회 2,075
12년 전 조회 1,685
12년 전 조회 2,209
12년 전 조회 1,845
12년 전 조회 1,663
12년 전 조회 3,920
12년 전 조회 1,820
12년 전 조회 1,631