How to change the color of a javascript table by moving the mouse in and out, and clicking the result _ javascript tips-js tutorial

Source: Internet
Author: User
This article mainly introduces how to change the color of a javascript table and how to move the mouse in and out, and how to click it. It involves some techniques related to how to change the color of the line and click the mouse in javascript, which is of great practical value, for more information about how to change the color of a javascript table, move the cursor, and click it. Share it with you for your reference. The specific analysis is as follows:

Table line-by-line discoloration is also a js effect to improve user experience.

Effect implementation:

The color of the table's parity rows is different. This prevents users from reading data in serial mode.
The color changes when the mouse moves into a row. This allows users to clearly know which row they are reading.

Click to change the color of the table. This allows you to select the items you want to retain.

Note:

I % 2: The modulo value of each number and 2 is only 0 and 1, so that the color of the line can be changed.
Tables_li [I]. onoff = 1; To achieve click color change, the color is not overwritten when the mouse moves in and out.

Code:

 Untitled documentScript window. onload = function () {var tables = document. getElementById ("tables"); var tables_li = tables. getElementsByTagName ("tr"); var I = 0; var len = tables_li.length; for (I = 0; I
   1 Content   2 Content   3 Content   4 Content   5 Content   6 Content   7 Content   8 Content   9 Content   10 Content 
 

I hope this article will help you design javascript programs.

Related Article

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.