Pure js achieves the line-changing effect, and js achieves the line-changing effect.
The examples in this article share with you the specific code for implementing line-changing JavaScript For your reference. The specific content is as follows:
<Script type = "text/javascript"> function createTable () {// create a table var table = document. createElement ("table"); // set the number of rows in the table for (var I = 0; I <4; I ++) {var tr = document. createElement ("tr"); // set the number of columns in the table for (var j = 0; j <5; j ++) {var td = document. createElement ("td"); tr. appendChild (td); // Add text var txt = document. createTextNode ("wkk"); td. appendChild (txt);} // determine the color transformation if (I % 2 = 0) {// Add attribute (first) tr. style. backgroundColor = "# f0f";} else {tr. style. backgroundColor = "# ff0";} table. appendChild (tr);} // Add attribute (second) table. setAttribute ("border", "1px"); // table. style. border = "solid 1px red"; table. setAttribute ("width", "200px"); table. setAttribute ("height", "100px"); // Add it to the body document. body. appendChild (table);} // create table over createTable (); </script>
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.