ログインページを作成しようとしています。最初のテキスト ボックス (ユーザー名) からタブで移動すると、パスワードを入力する前に、入力したテキストに基づいた情報をページに表示したいと思います。現在、onblur イベントを使用して何かを表示するだけで問題が発生しています。これが私がこれまでに持っているものです。
<script type='text/javascript' language="javascript">
function createDiv()
{
var divTag = document.createElement("div");
divTag.style.position = "absolute";
divTag.style.top = "150px";
divTag.style.left = "450px";
divTag.style.zIndex = "20";
divTag.innerHTML = "This is information";
document.getElementByID('card').appendChild(divTag);
}
</script>
<body onload='init();'>
<div id="card" style="width:800px; z-index:10; height:600px; position:relative; margin-left:auto; margin-right:auto; text-align:center; margin-top:0px; background-image:url('customLoginBG.png'); background-repeat:no-repeat;">
<form method='post' action='/login'>
<ul style="list-style-type:none;">
<li> <input type='hidden' id='token' name='token' /> </li>
<li style="position:absolute; top:270px; left:260px;"> <input type='text' onblur="createDiv()" id='username' style="width:188px; height:27px; background-image:url('inputBar.png');" /> </li>
<li style="position:absolute; top:310px; left:260px;"> <input type='password' id='password' style="width:188px; height:27px; background-image:url('inputBar.png');" /> </li>
<li style="position:absolute; top:290px; left:455px;"> <input type='image' src="loginButton.png" value="Login" onclick='doLogin();' /> </li>
</ul>
</form>
</div>
</body>
考えや提案はありますか?onblur を表示するものを取得するだけでもよいでしょう。