这意味着现在我正在使用cherrypy和genshi框架在python的帮助下使用genshi将python变量发送到html文件,但是我想在javascript函数中访问该变量的变量,所以我该怎么办?..
html文件是:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:py="http://genshi.edgewall.org/">
<head>
<title>Home</title>
<script type="text/javascript">
function setparent(val) {
document.getElementById("tpar").value=val;
}
</script>
</head>
<body>
<div >
<table>
<div py:for="user in users">
<tr>
<td>
<div title="${user.userid}" onclick="setparent('${user.userid}')">${user.fname+" "+ user.lname}</div>
<py:if test="user.resource.__len__() > 0">
<div>
<py:for each="res in user.resource">
<div><a href="">${user.resource[res]}</a></div>
</py:for>
</div>
</py:if>
</td>
</tr>
</div>
</table>
</div>
</body>
</html>
因为我想将 py 的“用户”变量访问到 javascriptfunction
你能告诉我这个吗?