close


插入背景語法

插入背景語法

插入背景語法



er">


這是固定背景的語法↘



<STYLE>

body{ background-attachment : fixed;

background-repeat:no-repeat;

background-position: 20% 40%;

background-image : url(背景網址);}

</STYLE>



20%→數字越小越往左邊移動

40%→數字越小越往上面移動



這是固定在左下角的語法↘



<head><style type=text/css>

<!--

body{

background-image:url(背景網址);

background-position:left bottom;

background-attachment:fixed;

background-repeat:no-repeat;}

-->

</style>



普通固定背景圖語法↘



<body><body background="背景圖ㄉ網址" bgproperties="fixed">

</body>



選取似的背景圖↘



<SELECT onchange=document.body.style.background=this.options[this.selectedIndex].value>

<OPTION value="url('')">↓請選取背景圖↓</OPTION>

<OPTION value="url('背景圖連結網址')">選取背景1</OPTION>

<OPTION value="url('背景圖連結網址')">選取背景2</OPTION>

<OPTION value="url('背景圖連結網址')">選取背景3</OPTION>

<OPTION value="url('背景圖連結網址')">選取背景4</OPTION>

<OPTION value="url('背景圖連結網址')">選取背景5</OPTION>

<OPTION value="url('背景圖連結網址')">選取背景6</OPTION>

</SELECT>



普通背景語法↘



<body bgproperties="fixed" background="網址">



定時換背景語法↘



<SCRIPT Language="JavaScript">

var backgroundimage=new Array("圖片網址","圖片網址","圖片網址","圖片網址")

var swapspeed=10

var timer

var imgpreload=new Array()

if (document.all) {

for (i=0;i<=backgroundimage.length-1;i++) {

imgpreload[i]=new Image()

imgpreload[i].src=backgroundimage[i]

}}var i_backgroundimage=0

swapspeed=swapspeed*1000

function swapimages() {if (document.all) {

window.status=i_backgroundimage

document.body.background=backgroundimage[i_backgroundimage]

i_backgroundimage++

if (i_backgroundimage>=backgroundimage.length) {i_backgroundimage=0}timer=setTimeout("swapimages()",swapspeed)

}}window.onload=swapimages

</SCRIPT>



參考資料
網路