저는 Javascript와 래칫 (ratchet)을 처음 사용하는 사람입니다. 익숙해지기 위해 작은 앱을 만들려고합니다. 다음 코드를 작성했지만 제대로 작동하지 않습니다. 뒤로 버튼에서 메모를 저장하는 자바 스크립트를 가져오고 싶습니다. 하지만 note_back()을 찾을 수 없다는 오류가 나타납니다. 내가 뭘 잘못 했니?래칫에서 onclick 이벤트를 사용하는 방법?
index.html을
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Notes</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link href="css/ratchet.css" rel="stylesheet">
<script src="js/ratchet.js"></script>
</head>
<body>
<header class="bar bar-nav">
<a class="icon icon-plus pull-right" data-transistion="slide-in" href="note.html"></a>
<h1 class="title">Notes</h1>
</header>
<div class="content">
<ul class="table-view">
</ul>
</div>
</body>
</html>
note.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Note</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link href="css/ratchet.css" rel="stylesheet">
<script src="js/ratchet.js"></script>
<script src="js/notecontroller.js"></script>
</head>
<body>
<header class="bar bar-nav">
<a class="icon icon-left pull-left" onclick="javascript:note_back()"></a>
<a class="icon icon-trash pull-right" onclick="javascript:note_delete()"></a>
<h1 class="title">Add Note</h1>
</header>
<form>
<br>
<br>
<br>
<textarea id="notetext" rows="10"></textarea>
</form>
</body>
</html>
notecontroller.js
function note_back() {
console.log("reached note_back");
localStorage.setItem("note",document.getElementById("notetext"));
window.location.href="index.html";
}
function note_delete() {
console.log("reached note_delete");
localStorage.removeItem("note");
window.location.href="index.html";
}
크레아티닌 eenshot :
ratchet.js가 ajax를 사용하여 페이지 전환에 대한 내용을로드하므로 응용 프로그램이 SPA처럼 작동하므로 note.html이 표시되지 않습니다. Note.html이 검색되고 구문 분석되고 콘텐츠가 스왑 된 다음 창 위치가 기록 API를 사용하여 설정됩니다. – kindasimple
PUSH는 어떻게 호출합니까? 이 문제를 해결하려고합니다. http://stackoverflow.com/questions/30178538/how-do-i-trigger-ratchets-push-manually – jgauna