属性のノード値
属性のノード値
<?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/test15.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>
<!--
test15.js
//画面の起動時に呼びだされます
Event.observe( window, 'load', getFormContents );
//イベントを登録します
function getFormContents(){
var obj = document.getElementById("btn1");
setListener(obj, "click", funcGetData);
}
function funcGetData(e)
{
//値(value)を取得します
var staff_id=document.getElementById("staff_id").value;
var html="";
switch (parseInt(staff_id))
{
case 1:
html += "<table border=1>";
html += "<tr>";
html += "<td>";
html += "メソッド";
html += "</td>";
html += "<td>";
html += "値";
html += "</td>";
html += "</tr>";
html += "<tr>";
html += "<td>";
html += "document.getElementById(\"staff_id\").getAttributeNode(\"size\").nodeType";
html += "</td>";
html += "<td>";
html += document.getElementById("staff_id").getAttributeNode("size").nodeType;
html += "</td>";
html += "</tr>";
html += "<tr>";
html += "<td>";
html += "document.getElementById(\"staff_id\").getAttributeNode(\"size\").nodeName";
html += "</td>";
html += "<td>";
html += document.getElementById("staff_id").getAttributeNode("size").nodeName;
html += "</td>";
html += "</tr>";
html += "<tr>";
html += "<td>";
html += "document.getElementById(\"staff_id\").getAttributeNode(\"size\").nodeValue";
html += "</td>";
html += "<td>";
html += document.getElementById("staff_id").getAttributeNode("size").nodeValue;
html += "</td>";
html += "</tr>";
html += "</table>";
break;
default:
html += "<table><tr><td>該当するデータが存在しません<br />IDを変更して再度検索してください。</td></tr></table>";
break;
}
$("tbl").innerHTML=html;
}
--------------------------------------------------
-->
|
|