Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 30th, 2004, 03:33 AM
Authorized User
 
Join Date: Jun 2004
Location: , , .
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
Reply With Quote
  #2 (permalink)  
Old June 30th, 2004, 03:38 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
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

Reply With Quote
  #3 (permalink)  
Old June 30th, 2004, 04:06 AM
Authorized User
 
Join Date: Jun 2004
Location: , , .
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:):)

Reply With Quote
  #4 (permalink)  
Old June 30th, 2004, 04:34 AM
Authorized User
 
Join Date: Jun 2004
Location: , , .
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

Reply With Quote
  #5 (permalink)  
Old June 30th, 2004, 06:08 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
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

Reply With Quote
  #6 (permalink)  
Old July 29th, 2004, 02:31 PM
Authorized User
 
Join Date: Jun 2004
Location: , , .
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Chris, thanks a ton buddy.


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 05:35 AM.


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