JS实现让网页背景图片斜向移动的方法

复制代码 代码如下:

<html>
<head>
<title>JS实现让网页背景图片斜向移动</title>
<body background="images/changshi.ico">
<script language="Javascript">
<!--
function selectAll(theField){
var tempval=eval("document."+theField)
tempval.focus()
tempval.select()
}
//-->
</script>
<script language="Javascript">
<!--
var background = "images/changshi.ico";
var speed = 0;
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
if (browserName != "Netscape" || browserVer >= 4.5) {
function moveback(movert,movedn,hPos,vPos) {
if (arguments[4])
document.body.style.backgroundImage = "url(\"" + arguments[4] + "\")";
if (arguments[5])
document.body.style.backgroundRepeat = arguments[5]
if (!isNaN(hPos)) {
if ((movert!=0) && (hPos>0)) hPos=-100000
hPos += movert
}
if (!isNaN(vPos)) {
if ((movedn!=0) && (vPos>0)) vPos=-100000
vPos+= movedn
}
document.body.style.backgroundPosition= hPos + " " + vPos
if (isNaN(hPos)) hPos = "\"" + hPos + "\""
if (isNaN(vPos)) vPos = "\"" + vPos + "\""
setTimeout("moveback("+movert+","+movedn+","+hPos+","+vPos+")",speed)
}
moveback(1,1,0,0, background);
}

//-->
</script>
</body>
</html>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgfjpj.html