<!doctype html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Thymeleafサンプル</title>
<meta charset="UTF-8" />
<script type="text/javascript" src="./js/jquery-2.2.3.js"></script>
<script type="text/javascript" th:inline="javascript">
$(function(){
/*<![CDATA[*/
var myname = /*[[${CConst.CONST_HIS_NAME}]]*/ 'スプリング太郎';
var classname = /*[[${CConst.CONST_NAME_CLASS}]]*/ '';
/*]]>*/
$("#btn_draw").click(function(){
$("#id_label").text(unescape(myname));
$("#id_label").addClass(classname);
});
});
</script>
<style>
<!--
.nameattr {
color : blue;
font-weight:bold;
}
.namered {
color : red;
font-weight:bold;
}
.namenormal {
color : black;
}
//-->
</style>
</head>
<body>
<table>
<tr>
<td> <input id="btn_draw" type="button" value="実行" /> </td>
</tr>
<tr>
<td ><span id="id_label">彼の名前</span></td>
</tr>
<tr>
<td ><span class="namenormal" th:class="${CConst.CONST_NAME_CLASS_RED}" th:text="${CConst.CONST_HER_NAME}">彼女の名前</span></td>
</tr>
</table>
</body>
</html>
|