I am using the blood elf template as basics for my guild's website (http://d.dkpsystem.com/) and I tried creating a random avatar script in place of the belf pic at the header. Thing is, I've been hitting my head against the wall this whole evening and I need a second opinion.
Original source:
CSS
#belf
{
background: url('http://dkpfiles.com/d/files/img.png') no-repeat top center;
position: absolute;
left: 0;
top: 0;
height: 210px;
width: 840px;
z-index: 75 !important;
}
HTML
<div id="belf"></div>
What I am trying to do..
HTML
<SCRIPT LANGUAGE="JavaScript">
var avatar_1="http://dkpfiles.com/d/files/img1.png"
var avatar_2="http://dkpfiles.com/d/files/img2.png"
var rand=Math.round(Math.random())
if (rand==1)
avatar=avatar_2
if (rand==0)
avatar=avatar_1
</script>
and then, instead of
<div id="belf"></div>
I use..
<script language="JavaScript">
document.write('<div background="'+avatar+'" style="background-repeat: no-repeat; position: absolute; left: 0; top:
0; height: 210px; width: 840px; z-index: 75;"></div>')
</script>
When I use this code, I just get no avatar showing. Any ideas what am I doing wrong? I believe it's a simple mistake
as I am not used to coding but I am really stuck.