info box (tooltip) question

liunx

Guest
The code below is my attempt at a general purpose info-box (tootip). There is one thing that I haven't figured out yet and that is how to change the X wide of the box so it doesn't fall off the screen to the right. How can I make info_box_width dynamic as in the commented line about where it is set?<br />
<br />
Thanks,<br />
RON C<br />
<br />
if (document.all)<br />
{<br />
//info_box_width = Math.max(250, 500-event.clientX);<br />
info_box_width = 550;<br />
config =<br />
'<div id = "info_box" style = "position:absolute; visibility:hidden">'<br />
+'<font color = "#C0C0C0">'<br />
+ '<table border = "1" cellspacing = "0" cellpadding = "4" bgcolor = "#000060" width="' <br />
+ info_box_width + '">' <br />
+ '<tr><td width="100%">' <br />
+ info_box_title<br />
+ '</td></tr>' <br />
+ '<tr><td>' <br />
+ info_box_title_info<br />
+ '</td></tr>'<br />
+ '</table>' <br />
+ '</font>'<br />
+ '</div>';<br />
document.write(config);<br />
}<br />
function move_info_box()<br />
{<br />
if (document.all)<br />
{<br />
info_box.style.visibility="visible";<br />
}<br />
info_box.style.left = document.body.scrollLeft + event.clientX;<br />
info_box.style.top = document.body.scrollTop + event.clientY;<br />
}<br />
document.onmousemove = move_info_box;<!--content-->Sorry for asking a dumb question. By removing the original width = info_box_width code, it works as I'd like.<br />
<br />
Thanks and hope someone can use the corrected code.<br />
<br />
RON C<br />
<br />
<br />
if (document.all)<br />
{<br />
config =<br />
'<div id = "info_box" style = "position:absolute; visibility:hidden">'<br />
+'<font color = "#C0C0C0">'<br />
+ '<table border = "1" cellspacing = "0" cellpadding = "4" bgcolor = "#000060">' <br />
+ '<tr><td width = "100%">' <br />
+ info_box_title<br />
+ '</td></tr>' <br />
+ '<tr><td>' <br />
+ info_box_title_info<br />
+ '</td></tr>'<br />
+ '</table>' <br />
+ '</font>'<br />
+ '</div>';<br />
document.write(config);<br />
}<br />
function move_info_box()<br />
{<br />
if (document.all)<br />
{<br />
info_box.style.visibility = "visible";<br />
}<br />
info_box.style.left = document.body.scrollLeft + event.clientX;<br />
info_box.style.top = document.body.scrollTop + event.clientY;<br />
}<br />
document.onmousemove = move_info_box;<!--content-->I do have a new one related to this code.<br />
<br />
How might I make it work with an animation and have info_box_title_info change from ani-frame to ani-frame?<br />
<br />
Thanks,<br />
RON C<!--content-->
 
Back
Top