Solved

Hover Box with text

Posted on 2011-02-17
14
1,196 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
 

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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

When writing CSS, there are a few simple rules that will make your life easier.    1. Using ‘* {box-sizing:border-box;}’. Using this will wrap all your elements in a nice little compact box-model that will give you the width you want, like so... …
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now