บทความนี้อธิบายวิธีการของตารางควบคุม JS เพื่อใช้แถวแยกแสง แบ่งปันสำหรับการอ้างอิงของคุณ การวิเคราะห์เฉพาะมีดังนี้:
นี่เป็นรหัสแยกที่สวยงามมาก
ในความเป็นจริงมันเป็นสายแนวนอนแบบแยกสีสันสดใสที่ใช้งานโดยใช้ตารางควบคุม JS
คัดลอกรหัสดังนี้: <html>
<head>
<meta http-equiv = "content-type" content = "text/html; charset = gb2312">>
<title> JS Lines Lines นำมาใช้กับเซลล์ </title>
</head>
<body>
<script>
l = อาร์เรย์ (6,7,8,9, 'a', 'b', 'b', 'c', 'd', 'e', 'f')
t = "<ความสูงของตาราง = 4 width = 100% cellpacing = 0 cellpadding = 0> <tr>"
สำหรับ (x = 0; x <40; x ++) {t+= "<td id = a_mo"+x+"> </td>"}
document.write (t+"</tr> </table>"
ฟังก์ชั่น f1 (y) {สำหรับ (i = 0; i <40; i ++) {c = (i+y)%20; ถ้า (c> 10) c = 20-c
document.all ["a_mo"+(i)]. bgcolor = "'#00"+l [c]+l [c]+"00'"} y ++
settimeout ('f1 ('+y+')', 1)} f1 (1)
</script>
</body>
</html>
ฉันหวังว่าบทความนี้จะเป็นประโยชน์กับการเขียนโปรแกรม JavaScript ของทุกคน