<style type="text/css">
div.mouseView { padding:10px; width:300px; position:absolute; border:2px solid #ccc; font-size:12px; background-color:#fafafa; } /* 스타일은 자신에 맞게 수정 */
</style>
<script type="text/javascript">
<!--
var preview="";
var gobj="";
function attachEvent_(obj, evt, fuc, useCapture) {
if(!useCapture) useCapture=false;
if(obj.addEventListener) { // W3C DOM 지원 브라우저
return obj.addEventListener(evt,fuc,useCapture);
} else if(obj.attachEvent) { // MSDOM 지원 브라우저
return obj.attachEvent("on"+evt, fuc);
} else { // NN4 나 IE5mac 등 비 호환 브라우저
MyAttachEvent(obj, evt, fuc);
obj['on'+evt]=function() { MyFireEvent(obj,evt) };
}
}
function detachEvent_(obj, evt, fuc, useCapture) {
if(!useCapture) useCapture=false;
if(obj.removeEventListener) {
return obj.removeEventListener(evt,fuc,useCapture);
} else if(obj.detachEvent) {
return obj.detachEvent("on"+evt, fuc);
} else {
MyDetachEvent(obj, evt, fuc);
obj['on'+evt]=function() { MyFireEvent(obj,evt) };
}
}
function MyAttachEvent(obj, evt, fuc) {
if(!obj.myEvents) obj.myEvents= {};
if(!obj.myEvents[evt]) obj.myEvents[evt]=[];
var evts = obj.myEvents[evt];
evts[evts.length]=fuc;
}
function MyFireEvent(obj, evt) {
if(!obj.myEvents || !obj.myEvents[evt]) return;
var evts = obj.myEvents[evt];
for (var i=0;i<len;i++) {
len=evts.length;
evts[i]();
}
}
function previewShow(e, obj, pv) {
preview=pv;
gobj=obj;
attachEvent_(obj, "mousemove", previewMove, false);
attachEvent_(obj, "mouseout", previewHide, false);
}
function previewMove(e) {
var hb = document.getElementById(preview);
if(hb.parentElement) hb.parentElement.style.display="";
else hb.parentNode.style.display="";
var evt = e ? e : window.event;
var posx=0;
var posy=0;
if (evt.pageX || evt.pageY) { // pageX/Y 표준 검사
posx = evt.pageX +8;
posy = evt.pageY +16;
} else if (evt.clientX || evt.clientY) { //clientX/Y 표준 검사 Opera
posx = evt.clientX +10;
posy = evt.clientY +20;
if (window.event) { // IE 여부 검사
posx += document.body.scrollLeft;
posy += document.body.scrollTop;
}
}
hb.style.left = posx + "px";
hb.style.top = posy + "px";
}
function previewHide() {
var hb = document.getElementById(preview);
if(hb.parentElement) hb.parentElement.style.display="none";
else hb.parentNode.style.display="none";
detachEvent_(gobj,"mousemove", previewMove, false);
}
-->
</script>
<span style="display:none;"><div id="t_tip1" class="mouseView">이곳은 박스안에 있는 설명이 들어가는 부분입니다.</div></span>
<br><br>
<a href="#" onmouseover="previewShow(event,this,'t_tip2');">마우스를 올려보세요. 두번째 박스</a>
<span style="display:none;"><div id="t_tip2" class="mouseView">박스모양은 스타일시트로 간단히 수정</div></span>
첨부파일 확인해보세요.
댓글 없음:
댓글 쓰기