JavaScript _ javascript skills

Source: Internet
Author: User
This article mainly introduces how to control the hide and show effect of the web page layer by using JavaScript. It involves the skill of javascript to operate the dynamic effect of web page elements and is of great practical value, for more information about how to control the hide and show effect of the web page by using JavaScript, see the following example. Share it with you for your reference. The details are as follows:

 
 
   
 
 
 Cool DIV layer expansion and contraction effectScript function $ (element) {return element = document. getElementById (element);} function $ D () {var d = $ ('class1content'); var h = d. offsetHeight; var maxh = 300; function dmove () {h + = 50; // set the layer expansion speed if (h> = maxh) {d. style. height = '300px '; clearInterval (iIntervalId);} else {d. style. display = 'block'; d. style. height = h + 'px ';}} iIntervalId = setInterval (dmove, 2);} function $ D2 () {var d =$ ('class1content '); var h = d. offsetHeight; var maxh = 300; function dmove () {h-= 50; // set the layer shrinkage speed if (h <= 0) {d. style. display = 'none'; clearInterval (iIntervalId);} else {d. style. height = h + 'px ';}} iIntervalId = setInterval (dmove, 2);} function $ use () {var d =$ ('class1content '); var sb = $ ('stateid'); if (d. style. display = 'None') {$ D (); sb. innerHTML = 'default';} else {$ D2 (); sb. innerHTML = 'expand ';} script

Hide the DIV Layer

Once there was a sincere love in front of me,
I did not cherish,
I regret it when I lose it,
This is the most painful thing in the world.
If God could give me another chance,
I will say three words to the girl:
I love you.
If you have to add a deadline for this fall in love,
I want ...... 10 thousand years !"

I hope this article will help you design javascript programs.

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.