属性追加
属性追加
<?xml version="1.0" encoding="utf-8" ?>
<!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-EQUIVE="Content-Type" CONTENT="text/html;charset=utf-8" />
<title>属性追加</title>
<script src="../js/prototype.js" type="text/Javascript"></script>
<script src="../js/funcs.js" type="text/Javascript"></script>
<script src="../js/test18.js" type="text/Javascript"></script>
</head>
<body>
<form id=frm name=frm>
<table>
<tr>
<td>ID<input type=text size=10 id=staff_id /></td>
</tr>
<tr>
<td style="text-align:center;"><input type=button id=btn1 value="検索"></td>
</tr>
</table>
<!-- 結果リスト -->
<div id=tbl></div>
</form>
</body>
</html>
<!--
test18.js
//画面の起動時に呼びだされます
Event.observe( window, 'load', getFormContents );
//イベントを登録します
function getFormContents(){
var obj = document.getElementById("btn1");
setListener(obj, "click", funcGetData);
}
function funcGetData(e)
{
document.getElementById("staff_id").setAttribute("class", "class1");
var attribute = document.getElementById("staff_id").getAttribute("class");
$("tbl").innerHTML="属性値 = " + attribute + " のclass属性を追加しました。";
}
--------------------------------------------------
-->
|
|