A prompt box with bubbles

Source: Internet
Author: User

(A), CSS/bubble-tooltip.css code is as follows:

 

# Bubble_tooltip {
Width: 147px;
Position: absolute;
Display: none;
}
# Bubble_tooltip. bubble_top {
Background-image: URL ('../images/bubble_top.gif ');
Background-repeat: No-Repeat;
Height: 16px;
}
# Bubble_tooltip. bubble_middle {
Background-image: URL ('../images/bubble_middle.gif ');
Background-repeat: Repeat-y;
Background-position: Bottom left;
Padding-left: 7px;
Padding-Right: 7px;
}
# Bubble_tooltip. bubble_middle span {
Position: relative;
Top:-8px;
Font-family: trebuchet MS, lucida sans Unicode, Arial, sans-serif;
Font-size: 11px;
}
# Bubble_tooltip. bubble_bottom {
Background-image: URL ('../images/bubble_bottom.gif ');
Background-repeat: No-Repeat;
Background-repeat: No-Repeat;
Height: 44px;
Position: relative;
Top:-6px;
}

 

(2), JS/bubble-tooltip.js code is as follows:

Function showtooltip (E, text ){
If (document. All) E = event;
 
VaR OBJ = Document. getelementbyid ('bubble _ tooltip ');
VaR obj2 = Document. getelementbyid ('bubble _ tooltip_content ');
Obj2.innerhtml = text;
OBJ. style. Display = 'block ';
VaR ST = math.max(document.body.scrolltop,document.doc umentelement. scrolltop );
If (navigator. useragent. tolowercase (). indexof ('safari ')> = 0) ST = 0;
VaR leftpos = E. clientx-100;
If (leftpos <0) leftpos = 0;
OBJ. style. Left = leftpos + 'px ';
OBJ. style. Top = E. clienty-obj. offsetheight-1 + st + 'px ';
}

Function hidetooltip ()
{
Document. getelementbyid ('bubble _ tooltip '). style. Display = 'none ';
 
}

 

(3). Images/The following is a bubble image. You can download it for free here:

 

 

The code for the page (4)、index.html) is as follows:

<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> JavaScript webpage bubble prompt box </title>
<Style type = "text/CSS">
Body {
Background-repeat: No-Repeat;
Padding-top: 85px;
Font-family: trebuchet MS, lucida sans Unicode, Arial, sans-serif;
Font-size: 0.9em;
Line-Height: 130%;

}
A {
Color: # d60808;
Text-Decoration: none;
}
A: hover {
Border-bottom: 1px dotted #317082;
Color: #307082;
}
</Style>
<LINK rel = "stylesheet" href = "CSS/bubble-tooltip.css" Media = "screen">
<SCRIPT type = "text/JavaScript" src = "JS/bubble-tooltip.js"> </SCRIPT>
</Head>
<Body>
<Div id = "bubble_tooltip">
<Div class = "bubble_top"> <span> </div>
<Div class = "bubble_middle"> <span id = "bubble_tooltip_content"> content is comming here as you probably can see. content is comming here as you probably can see. </span> </div>
<Div class = "bubble_bottom"> </div>
</Div>
<H1> DHTML balloon tooltip <P> This demo demonstrates how the balloon tooltip works. Roll your mouse over the red links in the text below. </P>
<P> <a href = "#" onmouseover = "showtooltip (event, 'This is a simple, simple test'); Return false" onmouseout = "hidetooltip () "> Roll Over Me </a> to see the tooltip in action. </P>
<P> and here's some more content
<A href = "#" onmouseover = "showtooltip (event, 'This is the content of the tooltihis is the content of the tooltiphis content of the tooltiphis is the content of the tooltiphis the content of the tooltiphis is the content of the tooltipp. this is the content of the tooltip. '); Return false "onmouseout =" hidetooltip () "> sharejs.com </a> </P>
<P> This is the last piece of the content on this web page </P>

<Br>
</Body>
</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.