javascript backgroundAttachment属性
Hasil terjemahan:
latar belakang
Bahasa Inggeris[ˈbækgraʊnd] Amerika[ˈbækˌɡraʊnd]
n (lukisan, dsb.) maklumat latar belakang; ˈtætʃmənt]美[ əˈtætʃmənt]
n. (dihantar melalui e-mel) lampiran, lampiran;
javascript backgroundAttachment属性sintaks
Fungsi: Tetapkan sama ada imej latar belakang dibetulkan atau tatal dengan seluruh halaman.
Sintaks: Object.style.backgroundAttachment=scroll|fixed
Nota: Sila tetapkan warna latar belakang yang tersedia, supaya jika imej latar belakang tidak tersedia, halaman juga boleh mendapatkan kesan visual yang baik.
javascript backgroundAttachment属性contoh
<html> <head> <style type="text/css"> body { background-color="#FFCC80"; background-image:url(http://img.php.cn/upload/article/000/005/656/5af270fd37755429.jpg); } p { color:white; } </style> <script type="text/javascript"> function changeAttachment() { document.body.style.backgroundAttachment="fixed"; } </script> </head> <body> <input type="button" onclick="changeAttachment()" value="Set background-image to be fixed" /> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> <p>This is a paragraph</p> </body> </html>
Run Instance »
Klik butang "Run Instance" untuk melihat instance dalam talian