2 개의 div (왼쪽 패널과 오른쪽 패널)로 구성된 html 페이지가 있습니다. 왼쪽 div는 백엔드의 값으로로드됩니다. 왼쪽 div에 값을 선택하면 오른쪽 div에 HTML 페이지를로드하고로드중인 페이지의 URL로 매개 변수를 전달하려고합니다. 나는 jQuery를 사용하여 HTML 페이지에서 오른쪽 div를로드하고 있는데도 url에 매개 변수를 전달하고 있습니다 (예 : "#. editor"). load ("editor.html? method ="+ m)).jquery는 서버 쪽 상호 작용과 window.location없이 html 페이지 간의 매개 변수를 액세스합니다.
내 질문은 어떻게 다른 HTML 페이지에서 '방법'값에 액세스합니까? window.location.href 사용하여 아무 소용이없는 값을 액세스하려고했습니다. 친절하게 도와주세요. 아래 코드를 붙여 넣었습니다.
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link type="text/css" href="./methodeditor.css" rel="stylesheet" />
<link type="text/css" href="../../css/ui-lightness/jquery-ui-1.8.14.custom.css" rel="Stylesheet" />
<script type="text/javascript" src="../../js/jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="../../js/jquery-ui-1.8.14.custom.min.js"></script>
<title>Method editor</title>
<script>
function gethtml(m){
$(".editor").load('editor.html?method='+m);
}
function save(){
var editor = document.getElementById("editor");
var win = editor.contentWindow;
var form = win.document.getElementById("editor");
form.submit();
}
function getmethods() {
$.get ("listmethods.php" , function(data) {
var methods = JSON.parse(data);
for (var i=0; i< methods.length; i++){
$(".list").append("<div id=" + methods[i] + " class= clickable ><tr><td>" + methods[i] + "</td></tr></div>");
}
});
}
$('.clickable').live('click', function() {
var m = this.id;
gethtml(m);
});
</script>
</head>
<body>
<div class="methodeditor">
<div class="list">
<script>
getmethods();
</script>
</div>
<div class="editor" >
<script>
gethtml('default.xml');
</script>
</div>
<div class="buttons">
<input type="button" value="save" onclick="save()" />
</div>
</div>
</body>
</html>