記事参照

No.1 2006/12/07 13:21
題:Re: オンマウス時に説明文を表示させる時に
名:カヅサツ

ええと、それは「タグ」ではありません。JavaScriptです。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="ja" dir="ltr">
<head>
<title></title>
<style type="text/css">
#CommentDiv{
position:absolute;
filter:Alpha(opacity=70);
display: none;
}
#CommentDiv span{
background-color: #FFE0E0;
border-width: 1px;
border-style: solid;
border-color: #333333;
padding: 20px;
line-height: 4;
}
</style>
<script type="text/javascript">
var comment ="";
function ShoComment(obj){
comment = obj.title;
var CommentDiv = document.getElementById('CommentDiv')
var CommentSpan = CommentDiv.getElementsByTagName('span')[0].childNodes[0];
var MainBody = document.getElementsByTagName('body')[0];
CommentDiv.style.display="block";
CommentDiv.style.posLeft = MainBody.scrollLeft+window.event.clientX+10;
CommentDiv.style.posTop = MainBody.scrollTop+window.event.clientY+10;
CommentSpan.nodeValue = comment;
obj.title = "";
}
function DelComment(obj){
obj.title = comment;
var CommentDiv = document.getElementById('CommentDiv')
CommentDiv.style.display="none";
var CommentSpan = CommentDiv.getElementsByTagName('span')[0].childNodes[0];
CommentSpan.nodeValue = "";
}
</script>
</head>
<body>
<div id="CommentDiv"style=""><span>(ここにコメントが入ります)</span></div>
<p><img src="http://www.courts.go.jp/img/main_bg.jpg" alt="裁判所" title="説明文"
onmouseover="ShoComment(this);" onmouseout="DelComment(this);"></p>
</body>
</html>



掲示板に戻る