Slide show untuk background web


logo doc

kalai ini saya akan share bagaimana membuat background web kita akan selalu berubah-ubah setelah kita reload page/halaman websitenya. langsung aja caranya:

1. buat file indek untuk menampilkan halaman website anda. (terserah),
contoh nam file index.html:

<html>
<head>
<title>Membuat background berubah-ubah</title>
</head>
<body>
isi content website anda
</body>
</html>

2. sisipkan script berikut di file index.html di atara <head> dan </head> yg telah dibuat sebelumnya,

<script type=’text/javascript’>

var HeaderImage = new Array ()

HeaderImage [0] = “bg1.png”
HeaderImage [1] = “bg2.png”
HeaderImage [2] = “bg3.png”

var random = Math.round (2 * Math.random ());

document.write (” <style> “);
document.write (” body{“);
document.write (‘background:url(“images/’+HeaderImage[random]+'”) repeat;’);
document.write (“background-attachment: fixed;”) ;
document.write (“padding: 0;margin: 0;”) ;
document.write (“}”) ;
document.write (“</style>”);
</script>

sehingga menjadi berikut untuk script lengkapnya:

<html>
<head>
<title>Membuat background berubah-ubah</title>

<script type=’text/javascript’>

var HeaderImage = new Array ()

HeaderImage [0] = “bg1.png”
HeaderImage [1] = “bg2.png”
HeaderImage [2] = “bg3.png”

var random = Math.round (2 * Math.random ());

document.write (” <style> “);
document.write (” body{“);
document.write (‘background:url(“images/’+HeaderImage[random]+'”) repeat;’);
document.write (“background-attachment: fixed;”) ;
document.write (“padding: 0;margin: 0;”) ;
document.write (“}”) ;
document.write (“</style>”);
</script>
</head>

<body>
isi content website anda
</body>
</html>

keterangan: bg1.png, bg2.png, bg3.png bisa anda ganti dengan link gambar anda

3. selesai tinggal preview hasilnya semoga berhasil.

12 Comments Add yours

  1. Thanks in support of shaing such a nice idea, piece of
    writing is good, thats why i hhave read it entirely

  2. J Sebastian mengatakan:

    Mas, saya sudah coba tetapi gambarnya tidak muncul hanya tulisannya saja.
    Saya sudah menaruh gambar di folder images dan juga di root tetapi latar gambarnya tidak muncul mohon bantuannya dimana letak kesalahannya. Salam sukses

  3. paid to do surveys mengatakan:

    Please let me know if you’re looking for a article writer for your weblog.
    You have some really good posts and I think I would be a good asset.
    If you ever want to take some of the load off,
    I’d love to write some content for your blog in exchange for a link back to
    mine. Please blast me an email if interested. Cheers!

  4. web page mengatakan:

    Call our workplace to consult with legal counsel and find out about your
    protection under the law and possibilities with our staff.
    Nov 25, 2013 – Study Xarelto to your 3-fold elevated risk of bleeding for a 4
    as well as extremely ill clients -fold elevated risk of important bleeding inpatients following joint surgery.

    The study involved over 14,000 individuals, and concluded that Xarelto
    was dangerous or powerful than warfarin.

  5. Hi there, its good article regarding media print, wwe all be familiar with media
    is a fantastic source of data.

  6. xtreme no free trial mengatakan:

    It’s going to be end օf mine day, however ƅеfore еnd I am reading this fantastic paragraph too
    increase my know-how.

  7. Your style is really unique compared to other people I’ve read stuff from.

    Many thanks for posting when you have the opportunity, Guess I will just bookmark this page.

  8. Cartas de amor mengatakan:

    It’s an awesome article in favor of all the web users; they will obtain benefit from it I am sure.

  9. Each photo voltaic PV system comes with a generation meter, which measures the
    quantity of electricity you generate.

  10. Pedro mengatakan:

    An organization in Canada has invented a street light that is powered
    by wind vitality, which runs a small turbine, fixed next to the photo voltaic panel on the sunshine.

    Owing to this reality there are a number of wind generators, which produce power sufficient to produce
    power to the entire country. It’s a must to get
    started by discovering out what sort of water
    heating system is the most sensible to your every
    day scorching water consumption, your climate and your spending allowance.

  11. got pussies mengatakan:

    Hi there! This blog post couldn’t be written much better!
    Going through this article reminds me of my previous roommate!
    He constantly kept talking about this. I most
    certainly will forward this information to him.
    Fairly certain he will have a very good read.
    I appreciate you for sharing!

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s