javasript代码
<divid="blink">闪烁的文字</div>
<scriptlanguage="javascript">
functionchangeColor(){
varcolor="#f00|#0f0|#00f|#880|#808|#088|yellow|green|blue|gray"
color=color.split("|")
document.getElementById("blink").style.color=color[parseInt(Math.random()*color.length)]
}
setInterval("changeColor()",200)
</script>
css代码就是文字闪烁text-decoration:blink不过很可惜,IE、Chrome或Safari不支持"blink"属性值,所以只有在Firefox和Opera下支持这CSS实现在闪动效果。加上js代码就可以了。
1、你的那段放在<body></body>之间2、要把文章内容放在<p id="ccon"></div>中间,并接在你那段后面;
2、再就是将这段代码放到<head></head>之间
<script language="javascript">
//保存背景颜色和字号
function setSz()
{
var va = document.getElementById("bjColor").value
setCookie("bjColor", va, 30)
va = document.getElementById("wzSize").value
setCookie("wzSize", va, 30)
va = document.getElementById("wzColor").value
setCookie("wzColor", va, 30)
va = document.getElementById("gd").value
setCookie("gd", va, 30)
alert("保存成功!")
return
}
//设置背景颜色和字号
function getSz()
{
var bjColor = getCookie('bjColor')
var wzSize = getCookie('wzSize')
var wzColor = getCookie('wzColor')
var gd = getCookie('gd')
if(bjColor != null)
{
document.getElementById("ccon").style.background=bjColor
setSelect(bjColor,"bjColor")
}
if(wzSize != null)
{
document.getElementById("ccon").style.fontSize=wzSize
setSelect(wzSize,"wzSize")
}
if(wzColor != null)
{
document.getElementById("ccon").style.color=wzColor
setSelect(wzColor,"wzColor")
}
if(gd != null)
{
SetScrollValue(gd)
setSelect(gd,"gd")
}
}
/*
* 设置滚动速度
*/
var currentpos,timer
var scrollValue = 100
function SetScrollValue(value)
{
scrollValue = value * 20
}
function initialize()
{
timer = window.setInterval("scrollwindow()",scrollValue)
}
function sc()
{
clearInterval(timer)
}
function scrollwindow()
{
currentpos = document.documentElement.scrollTop
window.scroll(0,++currentpos)
window.status = currentpos
if (currentpos != document.documentElement.scrollTop) sc()
}
document.ondblclick = function()
{
initialize()
}
document.onmousedown = function()
{
sc()
}
</script>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)