안녕하세요 저는 프로젝트에서 일하고 있습니다. 애니메이션이 끝난 후 타이머를 시작하고 타이머를 onkeypress하는 것을 중지 할 수 있다면 어떻게 생각하고 있었습니까? 그런 다음 시간 결과를 다른 페이지로 보냅니 까?애니메이션을 만든 후에 타이머/스톱워치를 만들고 시작하십시오.
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Exercise1</title>
<style>
.first-child {
width: 200px;
height: 200px;
background: white;
margin-top: 150px;
margin-bottom: 50px;
margin-right: 0px;
margin-left: 550px;
-webkit-animation: myfirst 1s;
animation: myfirst 1s;
}
@-webkit-keyframes myfirst {
0% {background: white;}
20% {background: white;}
40% {background: white;}
60% {background: white;}
80% {background: white;}
100% {background: red;}
}
.first-parent {
color: blue;
margin-top: 5px;
margin-bottom: 50px;
margin-left: 600px;
margin-right: 0px;
}
.second-parent {
color: red;
margin-top: 0px;
margin-bottom: 50px;
margin-left: 40px;
margin-right: 0px;
}
p {
margin-left: 640px;
}
</style>
</head>
<body>
<div class='first-child'></div>
<button class='first-parent' onclick="window.location.href='Exercise2.html' ">B</button>
<button class='second-parent' onclick="window.location.href='Exercise2.html' ">R</button>
<br />
<p>1/2</p>
<script>
document.onkeypress = function(b) {
b = b || window.event;
var charCode = b.charCode || b.keyCode,
character = String.fromCharCode(charCode);
console.log(charCode);
window.location.href="Exercise2.html";
};
document.onkeypredss = function(r) {
r = r || window.event;
var charCode = r.charCode || r.keyCode,
character = String.fromCharCode(charCode);
console.log(charCode);
window.location.href='Exercise2.html';
};
</script>
</body>
</html>
당신은 내가 아직 타이머를 가지고하지 않습니다 볼 수 있듯이 ... 미안해 : 그리고 타이머 나 스톱워치 그래서 카운터 또는 다른 어떤 ... 어쨌든 여기
가 원래의 코드입니다 의미 저에게 물어볼 질문이 있으면 HTML, CSS, JavaScript에 익숙하지만 jQuery를 알고 있습니다. 또 다른 방법이 있다면 기꺼이 들려줍니다. 미리 감사드립니다, 평화!
좋아. 콘솔에서 보니 : "Uncaught ReferenceError : $가 정의되지 않았습니다."크롬과 Firefox 모두 – Nikki
@Nikki 즉, jQuery를 포함하지 않았다는 의미입니다. Google에서이를 수행하는 방법을 검색하십시오. 기본적으로해야 할 일은 스크립트 선언에서 jQuery 파일에 대한 링크를 추가하는 것입니다. –
@ 닛키 그리고? 유용 했습니까? –