ใช้งานโดยใช้ Javascript คลิกสีที่เกี่ยวข้องด้วยเมาส์เพื่อเปลี่ยนสีพื้นหลังของหน้าเว็บแบบไดนามิก
นี่คือภาพหน้าจอ
ซอร์สโค้ด Javascript ที่เกี่ยวข้องคือ:
คัดลอกรหัสรหัสดังต่อไปนี้:
var hex = อาร์เรย์ใหม่ (6)
ฐานสิบหก[0] = "FF"
ฐานสิบหก[1] = "ซีซี"
ฐานสิบหก[2] = "99"
ฐานสิบหก[3] = "66"
ฐานสิบหก[4] = "33"
ฐานสิบหก[5] = "00"
จอแสดงผลฟังก์ชั่น (สามเท่า) {
document.bgColor = '#' + แฝด
-
ฟังก์ชั่น DrawCell (แดง เขียว น้ำเงิน) {
document.write('<TD BGCOLOR="#' + แดง + เขียว + น้ำเงิน + '">')
document.write('<A HREF="javascript:display(/'' + (แดง + เขียว + น้ำเงิน) + '/')">')
document.write('<IMG SRC="place.gif" BORDER=0 HEIGHT=12 WIDTH=12>')
document.write('</A>')
document.write('</TD>')
-
ฟังก์ชั่น DrawRow (แดง, น้ำเงิน) {
document.write('<TR>')
สำหรับ (var i = 0; i < 6; ++i) {
DrawCell(แดง, ฐานสิบหก[i], สีน้ำเงิน)
-
document.write('</TR>')
-
ฟังก์ชั่น DrawTable (สีน้ำเงิน) {
document.write('<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>')
สำหรับ (var i = 0; i < 6; ++i) {
DrawRow(เลขฐานสิบหก[i],สีน้ำเงิน)
-
document.write('</TABLE>')
-
ฟังก์ชั่น DrawCube() {
document.write('<TABLE CELLPADDING=5 CELLSPACING=0 BORDER=1><TR>')
สำหรับ (var i = 0; i < 6; ++i) {
document.write('<TD BGCOLOR="#FFFFFF">')
DrawTable (ฐานสิบหก [i])
document.write('</TD>')
-
document.write('</TR></TABLE>')
-
วาดคิวบ์()