Menu
hey all, need some helping hand here since I can´t find elsewhere.
I am trying to put in some amount of “alt” text inside a link so once hovering the link a textbox will float right under with the text I want explaining with the link
I know I can use the “title” but it disappears after like 5 seconds so it is no good. I remember some time ago seeing this feature and it really looked nice with the custom made textbox than the ordinary IE explorer style.
thanks
[code=php]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<style type="text/css">
#altext{
font-family: Arial, Helvetica, sans-serif;
font-size: 9px;
color: #0000FF;
background-color: #FFFFCC;
padding: 2px;
width: 150px;
border: 1px solid #000000;
position:absolute;
display:none;
z-index:10;
}
</style>
<script language="JavaScript" type="text/JavaScript">
var txt= new Array()//set bellow the descriptive text
txt[0] = ' Some text here for LINK 1 text text text text bla bla';
txt[1] = ' Another text here for LINK #2 text text text text bla bla';
txt[2] = ' Text here for LINK #3 text text text text bla';
function showA(o,w){
oX=o.offsetLeft;
oY=o.offsetTop;
oH=o.offsetHeight;
d=document.getElementById('altext');
d.firstChild.nodeValue=txt[w];
d.style.left=oX;
d.style.top=oY+oH;
d.style.display='block';
}
function hideA(){
document.getElementById('altext').style.display='none';
}
</script>
</head>
<body>
<div id="altext"> </div>
<a href="#" onmouseover="showA(this,0)" onmouseout="hideA()">LINK1</a><br><br>
<a href="#" onmouseover="showA(this,1)" onmouseout="hideA()">LINK2</a><br><br>
<a href="#" onmouseover="showA(this,2)" onmouseout="hideA()">LINK3</a>
</body>
</html>
[/code]
var absStr = "Position:Absolute;Top:0;Left:0";
var yOff = 70; // use this to position the message in the vertical axis
var xOff = 20; // use this to position the message in the horizontal axis
function isNext(fName){
window.location = fName;
}
function stayHome(){
iL = document.body.scrollLeft;
iV = document.body.scrollTop;
mX = event.screenX-xOff+iL;
mY = event.screenY-yOff+iV;
isFloat.style.left = mX;
isFloat.style.top = mY;
}
document.onmousemove = stayHome;
window.onscroll = stayHome;
function insertFloatIMG(){
styleStr = "<Style>.msgFloat {"+absStr+";Border-Style:Solid;Border-Width:1px;Background-Color:Yellow;Padding-Right:5px;Padding-Left:5px;Padding-Top:3px;Padding-Bottom:3px;Font-family:Tahoma;Font-Size:13pt;Line-Height:95%;}</Style>";
divStr = "<DIV class=msgFloat id=isFloat></DIV>"
document.write(styleStr);
document.write(divStr);
}
function hideMessage(){
isFloat.style.visibility = 'hidden';
}
function showMessage(toolTip){
isFloat.style.visibility = 'visible'
isFloat.innerHTML = toolTip;
}
function initToolTip(){
insertFloatIMG();
hideMessage();
}
but Kor´s script doesn´t seem to work well with links inside a table, dunno know why
[/quote]
[code=php]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<style type="text/css">
#altext{
font-family: Arial, Helvetica, sans-serif;
font-size: 9px;
color: #0000FF;
background-color: #FFFFCC;
padding: 2px;
width: 150px;
border: 1px solid #000000;
position:absolute;
display:none;
z-index:10;
}
</style>
<script language="JavaScript" type="text/JavaScript">
var txt= new Array()//set bellow the descriptive text
txt[0] = ' Some text here for LINK 1 text text text text bla bla';
txt[1] = ' Another text here for LINK #2 text text text text bla bla';
txt[2] = ' Text here for LINK #3 text text text text bla';
function showA(o){
//sets the txt position according to the link's second Parent(the row) position
oX=o.offsetLeft+o.parentNode.parentNode.offsetLeft+document.getElementById('tab').offsetLeft;
oY=o.offsetTop+o.parentNode.parentNode.offsetTop+document.getElementById('tab').offsetTop;
oH=o.offsetHeight;
a=document.getElementById('tab').getElementsByTagName('a');
for(var i=0;i<a.length;i++){
if(o==a[i]){w=i;break}//sets the "index" parameter of the link
}
d=document.getElementById('altext');
d.firstChild.nodeValue=txt[w]; //gives value to txt
d.style.left=oX;
d.style.top=oY+oH;
d.style.display='block';
}
function hideA(){
document.getElementById('altext').style.display='none';
}
</script>
</head>
<body leftmargin="0" topmargin="0">
<table border="0" id="tab">
<tbody>
<tr>
<td><a href="#" onmouseover="showA(this)" onmouseout="hideA()">LINK1</a><br><br>
</td>
</tr>
<tr>
<td><a href="#" onmouseover="showA(this)" onmouseout="hideA()">LINK2</a><br><br>
</td>
</tr>
<tr>
<td><a href="#" onmouseover="showA(this)" onmouseout="hideA()">LINK3</a><br><br>
</td>
</tr>
</tbody>
</table>
<div id="altext"> </div>
</body>
</html>
[/code]
0.1.9 — BETA 5.17