Solved

Hover Box with text

Posted on 2011-02-17
14
1,202 Views
Last Modified: 2012-05-11
I would like when my website visitors hover over a images or text; a text box pops up,
Im trying to create a informational box about the section/field of the form they are on.
 The information in the box will be about 5 sentences long.


Please help me with this
0
Comment
Question by:overcolor
  • 6
  • 4
  • 2
  • +2
14 Comments
 
LVL 18

Expert Comment

by:Jerry Miller
ID: 34922954
If your website is ASP, there is a tooltip property for most controls. Here is one for a TextBox.

<asp:TextBox id="txtExample" Text="ToolTip Example" runat="server"
ToolTip="This is an example-textbox" />
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 34923051
do you want to show textbox as tooltip or a few sentences as tooltip?

please clarify
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 34923068
0
Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

 

Author Comment

by:overcolor
ID: 34923360
@jmiller1979 I'm using Coldfusion,
@gurvinder372: I would like a text box?
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 34923411
try this

But why did you wanted to show the textbox as tooltip at hover, since you may never be able to use the same
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<style>
		.text
		{
			font:15px red arial;
		}
		.tooltip
		{
			border:2px solid red;
			padding:2px;
			width:150px;
			display:none;
			position:absolute;
		}
		.tooltip input
		{
			width:150px;
		}
	</style>
	
	
	<script src="jquery-1.4.2.min.js"></script>
	<script>
		$(document).ready(function(){
			$('img, .text').mousemove(function(e)
			{
				var x = e.pageX;
				var y = e.pageY;
				$(".tooltip").css("top", y);
				$(".tooltip").css("left", x);
				$(".tooltip").show();
			});
			$('img, .text').mouseout(function(e)
			{
				$(".tooltip").hide();
			});
		});
	</script>

</HEAD>

<BODY>
	<div class="container">
		Put the cursor on the image <img src="logo.jpg"/>  <br/>

		Put the cursor on the image <img src="logo.jpg"/>  <br/>

		Put the cursor on the image <img src="logo.jpg"/>  <br/>

		Put your cursor on <span class="text">THIS</span>

	</div>
	<div class="tooltip"><input type="text" id="tooltipText"/></div>
</BODY>
</HTML>

Open in new window

0
 
LVL 40

Accepted Solution

by:
gurvinder372 earned 250 total points
ID: 34923444
try this code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<style>
		.text
		{
			font:15px red arial;
		}
		.tooltip
		{
			border:2px solid red;
			padding:2px;
			width:150px;
			display:none;
			position:absolute;
		}
		.tooltip input
		{
			width:150px;
		}
		img
		{
			height:50px;
			width:50px;
		}
	</style>
	
	
	<script src="jquery-1.4.2.min.js"></script>
	<script>
		$(document).ready(function(){
			$('img, .text').hover(function(e)
			{
				var x = e.pageX;
				var y = e.pageY;
				$(".tooltip").css("top", y);
				$(".tooltip").css("left", x);
				$(".tooltip").show();
				$(".tooltip input").focus();
			});
			$('img, .text').mouseout(function(e)
			{
				$(".tooltip").hide();
			});

			$(".tooltip input").blur(function(){
				$(".tooltipText").html($(this).val()):
			});
		});
	</script>

</HEAD>

<BODY>
	<div class="container">
		Put the cursor on the image <img src="logo.jpg"/>  <br/>

		Put the cursor on the image <img src="logo.jpg"/>  <br/>

		Put the cursor on the image <img src="logo.jpg"/>  <br/>

		Put your cursor on <span class="text">THIS</span>

	</div>
	<div class="tooltip"><input type="text" id="tooltipText"/></div>
	<div class="tooltipText"></div>
</BODY>
</HTML>

Open in new window

0
 

Author Comment

by:overcolor
ID: 34923462
@gurvinder372: what Language is this in?

All I'm trying to do is when a visitor puts the mouse over the "question mark" (image) next to a form field it shows them information on what the field is for..
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 34923515
@overcolor: this is jquery/html/css

all you need to do is change the selector of that image to appropriate one as per your HTML structure.
0
 
LVL 14

Expert Comment

by:quizwedge
ID: 34923972
In case you're looking for a ColdFusion specific solution, check out http://mobile.experts-exchange.com/Q_24199070.html There appears to be a tool tip tag that should be able to accomplish what you want.

Otherwise, gurvinder372's solution should work or at least be on a correct track. (I just haven't checked the code for errors.)
0
 
LVL 3

Assisted Solution

by:dagaz_de
dagaz_de earned 250 total points
ID: 34926669
try cftooltip, its a cool coldfusion tag.

<!--- These variables could be set dynamically --->
<cfset theItem="left-handed & other specialty wrenches">
<cfset theImage="lhbwrench.jpg">
 
<!--- The theItem string has an ampersand, so you must URL-encode it. --->
<cftooltip sourceForTooltip="tiptext.cfm?itemid=#URLEncodedFormat(theItem)#">
    <cfoutput>  
        <b>Try this one!</b>
        <img src="#theImage#" />
    </cfoutput>
</cftooltip>

The tiptext.cfm page could have a single CFML tag:

<cfoutput><b> Click to find more about #URL.itemid# </b></cfoutput>

if you want a cool html/javascript solution try wztooltip:

http://www.himmera.com/Javascript_scripts/Tooltip_Javascript_example_html_css_js_tooltips_JQuery-Tooltip_javascript_and_CSS_JavaScript,_DHTML_Tooltips_WalterZorn.com__9.htm

0
 

Author Comment

by:overcolor
ID: 34928348
I will try these codes out tonight thank you,
0
 

Author Comment

by:overcolor
ID: 34928669
@gurvinder372:

Im getting an syntax error  on line 47?
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 34928844
no its not, i have tested the code before posting
0
 
LVL 14

Expert Comment

by:quizwedge
ID: 34934755
Did you try my or @dagaz_de's ColdFusion based solution?
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question