⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 back15.htm

📁 javascript各种效果的实例及源代码
💻 HTM
字号:
<html>
<head>
<title>背景调色板</title>
<style type="text/css">
<!--
body {  font-family: "宋体"; font-size: 9pt; margin-top: 0px; margin-left: 0px; margin-right: 0px}
A { COLOR: black; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: none }
 A:hover { COLOR: red; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: underline }
a:active     { font: 9pt "宋体"; cursor: hand; color: #FF0033 }
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

</head>

<body bgcolor="#fef4d9">
<br>
<br>
<center><font color=red face="隶书" size=6>背景调色板</font></center>
<br>
<br><center>
<table border=5 bordercolor=blue borderlight=green>
<tr><td align=center><font size=5 color=red face="Arial, Helvetica, sans-serif"><strong>请把鼠标放上去(看看状态栏的变化)</strong></font></td></tr>
<tr><td align=center><script language="JavaScript">
<!--

// Copyright (c) 1996-1997 Tomer Shiran. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at http://www.geocities.com/~yehuda/

// create 6-element array
var hex = new Array(6)

// assign non-dithered descriptors
hex[0] = "FF"
hex[1] = "CC"
hex[2] = "99"
hex[3] = "66"
hex[4] = "33"
hex[5] = "00"

// accept triplet string and display as background color
function display(triplet) {
	// set color as background color
	document.bgColor = '#' + triplet

	// display the color hexadecimal triplet
	alert('现在的背景色是 #'+triplet)
}

// draw a single table cell based on all descriptors
function drawCell(red, green, blue) {
	// open cell with specified hexadecimal triplet background color
	document.write('<TD BGCOLOR="#' + red + green + blue + '">')

	// open a hypertext link with javascript: scheme to call display function
	document.write('<A HREF="javascript:display(\'' + (red + green + blue) + '\')">')

	// print transparent image (use any height and width)
	document.write('<IMG SRC="place.gif" BORDER=0 HEIGHT=12 WIDTH=12>')

	// close link tag
	document.write('</A>')

	// close table cell
	document.write('</TD>')
}

// draw table row based on red and blue descriptors
function drawRow(red, blue) {
	// open table row
	document.write('<TR>')

	// loop through all non-dithered color descripters as green hex
	for (var i = 0; i < 6; ++i) {
		drawCell(red, hex[i], blue)
	}

	// close current table row
	document.write('</TR>')
}

// draw table for one of six color cube panels
function drawTable(blue) {
	// open table (one of six cube panels)
	document.write('<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>')

	// loop through all non-dithered color descripters as red hex
	for (var i = 0; i < 6; ++i) {
		drawRow(hex[i], blue)
	}

	// close current table
	document.write('</TABLE>')	
}

// draw all cube panels inside table cells
function drawCube() {
	// open table
	document.write('<TABLE CELLPADDING=5 CELLSPACING=0 BORDER=1><TR>')

	// loop through all non-dithered color descripters as blue hex
	for (var i = 0; i < 6; ++i) {
		// open table cell with white background color
		document.write('<TD BGCOLOR="#FFFFFF">')

		// call function to create cube panel with hex[i] blue hex
		drawTable(hex[i])

		// close current table cell
		document.write('</TD>')
	}

	// close table row and table
	document.write('</TR></TABLE>')
}

// call function to begin execution
drawCube()

// -->
</script>
</td></tr></table></center>
<br>
<br>
<center>
<textarea name=source rows=12 cols=45 class=yk9>
脚本说明:
把如下代码加入<body>区域中
<script language="JavaScript">
<!--

// Copyright (c) 1996-1997 Tomer Shiran. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at http://www.geocities.com/~yehuda/

// create 6-element array
var hex = new Array(6)

// assign non-dithered descriptors
hex[0] = "FF"
hex[1] = "CC"
hex[2] = "99"
hex[3] = "66"
hex[4] = "33"
hex[5] = "00"

// accept triplet string and display as background color
function display(triplet) {
	// set color as background color
	document.bgColor = '#' + triplet

	// display the color hexadecimal triplet
	alert('现在的背景色是 #'+triplet)
}

// draw a single table cell based on all descriptors
function drawCell(red, green, blue) {
	// open cell with specified hexadecimal triplet background color
	document.write('<TD BGCOLOR="#' + red + green + blue + '">')

	// open a hypertext link with javascript: scheme to call display function
	document.write('<A HREF="javascript:display(\'' + (red + green + blue) + '\')">')

	// print transparent image (use any height and width)
	document.write('<IMG SRC="place.gif" BORDER=0 HEIGHT=12 WIDTH=12>')

	// close link tag
	document.write('</A>')

	// close table cell
	document.write('</TD>')
}

// draw table row based on red and blue descriptors
function drawRow(red, blue) {
	// open table row
	document.write('<TR>')

	// loop through all non-dithered color descripters as green hex
	for (var i = 0; i < 6; ++i) {
		drawCell(red, hex[i], blue)
	}

	// close current table row
	document.write('</TR>')
}

// draw table for one of six color cube panels
function drawTable(blue) {
	// open table (one of six cube panels)
	document.write('<TABLE CELLPADDING=0 CELLSPACING=0 BORDER=0>')

	// loop through all non-dithered color descripters as red hex
	for (var i = 0; i < 6; ++i) {
		drawRow(hex[i], blue)
	}

	// close current table
	document.write('</TABLE>')	
}

// draw all cube panels inside table cells
function drawCube() {
	// open table
	document.write('<TABLE CELLPADDING=5 CELLSPACING=0 BORDER=1><TR>')

	// loop through all non-dithered color descripters as blue hex
	for (var i = 0; i < 6; ++i) {
		// open table cell with white background color
		document.write('<TD BGCOLOR="#FFFFFF">')

		// call function to create cube panel with hex[i] blue hex
		drawTable(hex[i])

		// close current table cell
		document.write('</TD>')
	}

	// close table row and table
	document.write('</TR></TABLE>')
}

// call function to begin execution
drawCube()

// -->
</script>

</textarea>
<SCRIPT LANGUAGE="JavaScript">

<!-- hide

function goHist(a) 

{

   history.go(a);

}

//-->

</script>

<FORM METHOD="post">
<INPUT TYPE="button" VALUE="返回" onClick="goHist(-1)" style="background-color: #8000FF; color: rgb(255,255,255)">
</form>
</center>
<br>
<br>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -