배경 자동 스크롤
12011 단어 굴러가다
// <![CDATA[
function runCode(obj) {
var winname = window.open('', "_blank", '');
winname.document.open('text/html', 'replace');
winname.document.write(obj.value);
winname.document.close();
}
// ]]>
코드
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
>
<
html
xmlns
="http://www.w3.org/1999/xhtml"
>
<
head
>
<
meta
http-equiv
="Content-Type"
content
="text/html; charset=utf-8"
/>
<
title
>
</
title
>
<
script
type
="text/javascript"
>
window.onload
=
function
(){
var
scrollBackground
=
{
object:document.getElementById(
"
scrollBackground
"
),
endTop:
3700
,
nowTop:
0
};
var
scrollInterval
=
setInterval(
function
(){
scrollBackground.nowTop
=
(scrollBackground.nowTop
!=
scrollBackground.endTop)
?
(scrollBackground.nowTop
+
1
):
0
;
scrollBackground.object.style.backgroundPosition
=
"
0px -
"
+
scrollBackground.nowTop
+
"
px
"
;
},
50
);
}
</
script
>
</
head
>
<
body
style
="margin:0; padding:0"
>
<
div
id
="scrollBackground"
style
="width:1440px; height:300px; background:url(http://youlove.us/template/theme/youloveus/img/bg.jpg) no-repeat 0 0"
></
div
>
<!--mce:1--> <!--mce:2--> <!--mce:3--> <!--mce:4--> 00;">
</
body
>
</
html
>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> </title>
<script type="text/javascript">
window.onload = function(){
var scrollBackground = {
object:document.getElementById("scrollBackground"),
endTop:3700,
nowTop:0
};
var scrollInterval = setInterval(function(){
scrollBackground.nowTop = (scrollBackground.nowTop!=scrollBackground.endTop)?(scrollBackground.nowTop+1):0;
scrollBackground.object.style.backgroundPosition = "0px -" + scrollBackground.nowTop + "px";
},50);
}
</script>
</head>
<body style="margin:0; padding:0">
<div id="scrollBackground" style="width:1440px; height:300px; background:url(http://youlove.us/template/theme/youloveus/img/bg.jpg) no-repeat 0 0<!--mce:5--> <!--mce:6--> <!--mce:7--> <!--mce:8--> <!--mce:9--> "></div>
</body>
</html>