我目前想要制作几个图像的选框,但我的代码只允许一个.你知道我可以在这段代码中添加几个图像吗?(我已经尝试将图像直接添加到正文中的div元素中 - 它不起作用.)
<style type="text/css">
<!--
#container {
background-image: url(images/avycopy.jpg), url(images/5mwmcp.jpg);
height:428px;
width:284px;
background-repeat:repeat-x;
background-size:284px 428px;
background-position: top left, top right;
}
-->
</style>
<script type="text/javascript">
<!--
var p=0;
var speed=20; // vary this to suit, larger value - slower speed
window.onload=function() {
gallery();
}
function gallery() {
document.getElementById('container').style.backgroundPosition=p+'px 0';
p--; //change this to p-- for right to left direction
setTimeout('gallery()',speed);
}
//-->
</script>
Run Code Online (Sandbox Code Playgroud)