Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 30th, 2004, 03:33 AM
Authorized User
 
Join Date: Jun 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default Description box, when hover on certain word.

 Hi gurus,

 i have a avg knowledge of javascript. I am new to this forum though. i have a problem, i want to display a description box when mouse is hovered on certain text. (like a box appears when you hover mouse at any of the button of your browser). I cant figure out how to do that.

please help
thanks in advance:)

__________________
------------------------
http://www.indrajal.com
 
Old June 30th, 2004, 03:38 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi iniro,

You could just use html...
Code:
<span title="Some interesting caption">myText</span>
Best regards,

Chris

 
Old June 30th, 2004, 04:06 AM
Authorized User
 
Join Date: Jun 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by ChrisScott
 Hi iniro,

You could just use html...
Code:
<span title="Some interesting caption">myText</span>
Best regards,

Chris

Thanks chris it worked:):)

 
Old June 30th, 2004, 04:34 AM
Authorized User
 
Join Date: Jun 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have one more little question, my text for the title is more than one line , but when i see it online it shows me just 3/4th of a line followed by three dots.
what can i do to display whole line.
again thanks in advance

 
Old June 30th, 2004, 06:08 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi again,

I guess that's on Mozilla / NS / other browser. You'll probably need to do something custom - this should work for IE / Mozilla...

Code:
<html>

<head>
<title>Scrap</title>

<script type="text/javascript">
var gHideTimer;
function ShowTitle(e, pTitle){
    HideTitle();

    // very poor browser detection 
    var ie = navigator.userAgent.indexOf("MSIE") > 0;
    var div = document.getElementById("TitleDiv");
    div.innerHTML = pTitle;
    div.style.display = "block";
    div.style.top = (ie ? event.srcElement.offsetTop : e.target.offsetTop) + 30;
    div.style.left = (ie ? event.clientX : e.pageX) + 3;
    gHideTimer = setTimeout("HideTitle();", 5000);
}
function HideTitle(){
    if(gHideTimer != null){
        clearInterval(gHideTimer);
        gHideTimer = null;
    }
    var div = document.getElementById("TitleDiv");
    div.style.display = "none";
}

</script>

<style type="text/css">
#TitleDiv{
    font-family: 'MS Sans Serif', 'Sans Serif';
    font-size: 9pt;
    border: black 1px solid;
    background-color: lightyellow;
    display: none;
    position: absolute;
    top: 400px;
    padding: 2px;
}
</style>

</head>

<body onbeforeunload="">
<div id="TitleDiv"></div>

<span onmouseover="ShowTitle(event, 'a very long title just to check it works a very long title just to check it works a very long title just to check it works a very long title just to check it works a very long title just to check it works');" onmouseout="HideTitle();">myText</span>

<br /><br />

<span onmouseover="ShowTitle(event, 'a very long title just to check it works a very long title just to check it works a very long title just to check it works a very long title just to check it works a very long title just to check it works');" onmouseout="HideTitle();">my Other Text</span>

</body>

</html>
HTH,

Chris

 
Old July 29th, 2004, 02:31 PM
Authorized User
 
Join Date: Jun 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Chris, thanks a ton buddy.







Similar Threads
Thread Thread Starter Forum Replies Last Post
description != '' equivalent XMLUser XSLT 3 March 1st, 2008 12:58 PM
to get description of table MunishBhatia SQL Server 2000 2 December 5th, 2006 01:26 PM
highlighting the word in rich text box AnurRS C# 0 May 31st, 2006 06:41 AM
getting print dialog box in vb6 as in ms-word mohanbabu Access VBA 0 December 22nd, 2003 01:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.