大恩不言谢!!!
希望多多益善,多多益善。。。~~~~~~~~~~~~~~~~~~~~~~~~~~~
大家有的都交流一下
成功源于执著!!!!
各位大侠下边代码是个变换背景颜色的代码 在我机器上怎么老出现错误,请教拉~~~~~
<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>
先谢谢拉~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
好啊,不错,不过我还有一个比较好的
<onload="javascript:pageonload()">
<script language="javascript">
var message="欢迎访问:http://xlge.96.cn";
var x,y;
var step=12;
var flag=0;
message=message.split("");
var xpos=new Array();
for (i=0;i<=message.length-1;i++) {
xpos[i]=-50;
}
var ypos=new Array();
for (i=0;i<=message.length-1;i++) {
ypos[i]=-50;
}
function handlerMM(e) {
x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX+10;
y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY;
flag=1;
}
function makesnake() {
if (flag==1 && document.all) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step;
ypos[i]=ypos[i-1];
}
xpos[0]=x+step;
ypos[0]=y;
for (i=0; i<=message.length-1; i++) {
var thisspan = eval("span"+(i)+".style");
thisspan.posLeft=xpos[i];
thisspan.posTop=ypos[i];
thisspan.color=Math.random() * 255 * 255 * 255 + Math.random() *
255 * 255 + Math.random() * 255;
}
}
else if (flag==1 && document.layers) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step;
ypos[i]=ypos[i-1];
}
xpos[0]=x+step;
ypos[0]=y;
for (i=0; i<message.length-1; i++) {
var thisspan = eval("document.span"+i);
thisspan.left=xpos[i];
thisspan.top=ypos[i];
thisspan.color=Math.random() * 255 * 255 * 255 + Math.random() *
255 * 255 + Math.random() * 255;
}
}
}
</script>
<script language="javascript">
for (i=0;i<=message.length-1;i++) {
document.write("<span id='span"+i+"' class='spanstyle'>");
document.write(message[i]);
document.write("</span>");
}
if (document.layers) {
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
</script>
<script
language="javascript">
function pageonload() {
makesnake();
window.setTimeout("pageonload();", 2);
}
</script>
好东西!!收下了!!!!
我也发发一些JS特效吧,都是我测试成功的!
跟随鼠标移动的半透明图片:
[QUOTE]
<STYLE type=TEXT/CSS>
.tm {
FILTER: Alpha(Opacity=50) {透明度=50%}
}
</STYLE>
<DIV id=Layer1 style="z-index:101;HEIGHT: 31px; LEFT: 409px; POSITION: absolute; TOP: 131px; WIDTH: 14px"><IMG class=tm src="xx.gif"></DIV> {xx.gif即图片名}
<SCRIPT>
function move_layer()
{
Layer1.style.left=event.clientX+document.body.scrollLeft+10;
Layer1.style.top=event.clientY+document.body.scrollTop+10;
}
document.onmousemove =move_layer;
</SCRIPT>
[/QUOTE]
显示日期,关于定位我是用层的:
[QUOTE]
<script language=JavaScript>
today=new Date();
function initArray(){
this.length=initArray.arguments.length
for(var i=0;i<this.length;i++)
this[i+1]=initArray.arguments[i] }
var d=new initArray(
" 星期日",
" 星期一",
" 星期二",
" 星期三",
" 星期四",
" 星期五",
" 星期六");
document.write(
"<font color=##000000 style='font-size:9pt;font-family: 宋体'> ",
today.getYear(),"年",
today.getMonth()+1,"月",
today.getDate(),"日",
d[today.getDay()+1],
"</font>" );
</script>
[/QUOTE]
页面淡出:
[QUOTE]
<META http-equiv=Page-Exit content=blendTrans(Duration=0.6)> {(Duration=0.6) 持续时间=0.6秒}
[/QUOTE]
页面自动跳转:
[QUOTE]
<script>
setTimeout("window.location='html/index.html'",100000); {'html/index.html'为转到页面,100000=10秒}
</script>
[/QUOTE]
页面自动跳转(显示倒计时):
[QUOTE]
<script>
var url = "html/index.html"; {'html/index.html'为转到页面}
var loctime = 9; {9=9秒}
timedown.innerhtml = loctime;
var gourl = setInterval("downtimes()",1000);
function downtimes(){
loctime--;
timedown.innerHTML= loctime;
if(loctime <= 0){
clearInterval(gourl);
window.location = url;
}
}
</script>
然后把
<span id="timedown"></span>
加到文字中间,以显示倒计时。
[/QUOTE]