![]() |
#2
jingming2006-01-06 17:17
自己先背景色 // Copyright (c) 1996-1997 Tomer Shiran. All rights reserved. // create 6-element array // assign non-dithered descriptors // accept triplet string and display as background color // display the color hexadecimal triplet // draw a single table cell based on all descriptors // open a hypertext link with javascript: scheme to call display function // print transparent image (use any height and width) // close link tag // close table cell // draw table row based on red and blue descriptors // loop through all non-dithered color descripters as green hex // close current table row // draw table for one of six color cube panels // loop through all non-dithered color descripters as red hex // close current table // draw all cube panels inside table cells // loop through all non-dithered color descripters as blue hex // call function to create cube panel with hex[i] blue hex // close current table cell // close table row and table // call function to begin execution // --> |
各位大侠下边代码是个变换背景颜色的代码 在我机器上怎么老出现错误,请教拉~~~~~
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>用按钮更换网页背景色</title>
</head>
<body bgcolor="#fbe8f8">
<p align="center">
<big><big>
<font color="#0000ff"><b>用按钮更换网页背景色</b></font></big></big></p>
<hr>
<form>
<blockquote><blockquote><blockquote><p>
<input type="button" value="Papayawhip" onClick="document.bgcolor="papayawhip"">
<input type="button" value="blue" onClick="document.bgcolor="blue"">
<input type="button" value="gray" onClick="document.bgcolor="gray"">
<br>
<input type="button" value="lightcoral" onClick="document.bgcolor="lightcoral"">
<input type="button" value="white" onClick="document.bgcolor="white"">
<input type="button" value="red" onClick="document.bgcolor="red"">
<br>
<input type="button" value="whitesmoke" onClick="document.bgcolor="whitesmoke"">
<input type="button" value="orange" onClick="document.bgcolor="orange"">
<br>
<input type="button" value="dodgerblue" onClick="document.bgcolor="dodgerblue"">
<input type="button" value="yellow" onClick="document.bgcolor="yellow"">
<p>
</blockquote>
</blockquote>
</form>
</body>
</html>
下边是个显示浏览器版本的脚本 供大家享用:)
<script language="javascript">
<!--
//输出浏览器名称
document.write(navigator.appName)
//如果浏览器名称是Netscape
if(navigator.appName=="Netscape")
{
//输出Netscape的版本号
document.write(" "+navigator.appVersion)
}
//如果浏览器的名称是Microsoft Internet Explorer
if(navigator.appName=="Microsoft Internet Explorer")
{
//输出IE版本
document.write(" "+navigator.appVersion)
}
//-->
</script>
还有个问候的代码也有错误~~~诚心请教~~
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<script language="javascript">
now=new date()
hour=now.gethours()
if(hour<12){
document.write("<b>早上好,现在是:" +now.tolocalestring()+"")}
else if(hour<18){
document.write("<b>下午好,现在是:" +now.tolocalestring()+"")}
else if(hour>=18){
document.write("<b>晚上好,现在是:" +now.tolocalestring()+"")}
//获取浏览器的名称
var name=navigator.appName;
var vers=navigator.appVersion;
document.write("<br>很高兴结识你!愿我们是朋友!");
document.write("<br>您的浏览器是:"+name+"<br>");
document.write("版本号是:"+vers+"<br>");
document.write("推荐使用IE4.0,800*600*16位颜色模式");
</script>
</font>
</td>
</tr>
</table>
</body>
</html>
先谢谢拉~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~