Solve two minor problems in the project: div height control and JavaScript tooltips

Source: Internet
Author: User

Today, due to project overtime, two problems need to be solved.

1. dynamically changing the DIV height, so I searched on Google and found several useful links to solve my needs.

-Sometimes you define a style for a DIV, such as width = 50%, but you do not know the true width of the Div. You can obtain it in the following ways:
X = Document. getelementbyid ('testdiv ');
VaR xheight = x. offsetwidth;
Javascript has four such attributes: offsetheight, offsetleft, and offsettop. Note that these attributes are read-only.
 
-Set the DIV height and width:
X = Document. getelementbyid ('testdiv ');
X. style. Height = 100;

These two points help solve my needs.

Here is a link to one of my reference documents:
Get styles
Http://www.quirksmode.org/dom/getstyles.html

2. Use JavaScript to display some Tool tips on the page

-This is relatively easier. I have seen a website before.
Http://www.walterzorn.com/tooltip/tooltip_e.htm
After downloading the above document, I wrote a static html test, but tips cannot be displayed.
Later, I carefully read the text marked in red in the document.
Insert the following lines into the <body> section or your HTML file, preferably immediately before the closing </body> tag, but in any case after the last tag containing a tooltip:
<Script language = "JavaScript" type = "text/JavaScript" src = "wz_tooltip.js"> </SCRIPT>
<Script language = "JavaScript" type = "text/JavaScript" src = "wz_tooltip.js"> </SCRIPT> should be placed at the end of the page before being introduced, or at least after the last tooltips.
Finally, another problem was solved.

There is also a link on which there are many other tooltips implementation links. You can refer to the selection:
Http://www.blinklist.com/tag/tooltip/

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.