属性値
属性値
<?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/test14.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>
<!--
test14.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\").getAttribute(\"type\")";
html += "</td>";
html += "<td>";
html += document.getElementById("staff_id").getAttribute("type");
html += "</td>";
html += "</tr>";
html += "<tr>";
html += "<td>";
html += "document.getElementById(\"staff_id\").getAttribute(\"size\")";
html += "</td>";
html += "<td>";
html += document.getElementById("staff_id").getAttribute("size");
html += "</td>";
html += "</tr>";
html += "<tr>";
html += "<td>";
html += "document.getElementById(\"staff_id\").getAttribute(\"id\")";
html += "</td>";
html += "<td>";
html += document.getElementById("staff_id").getAttribute("id");
html += "</td>";
html += "</tr>";
html += "</table>";
break;
default:
html += "<table><tr><td>該当するデータが存在しません<br />IDを変更して再度検索してください。</td></tr></table>";
break;
}
$("tbl").innerHTML=html;
}
--------------------------------------------------
-->
|
|