PDA

View Full Version : overlay image on home page



dcj
02 Jun 2009, 01:19 AM
Hi - I'm using Dreamweaver to create a website - actually it's nearly complete - and now I am told that I have to make an image overlay on the home page advertising a special. I can create the image in any format, that's not my problem, but does anyone know how to put it into the site so that it opens first and foremost and also has a "x close" button so people can navigate away from it? An example of what I need to do is on this website: http://www.dconthefly.com

Any help is surely appreciated :nod:

dmcleary
02 Jun 2009, 01:34 AM
Hi dcj,

First up, let me say I'm not a DW user but I can explain in principle how what you need is done and you can decide whether it's possible in DW or whether you decide to script it yourself.

You need to create a DIV that is positioned, something like this:

<style>
#myAd{
position:absolute;
top:10px;
left:10px;
display:none;
}

<div id="myAd"></div>

You can then use a bit of javascript to display the DIV when the page loads, like this:

<body onload="document.getElementById('myAd').style.display='block';">

All things being well that will make your DIV appear. Of course, as you say, what you put in the DIV is up to you but your example uses an image. The close button is just a clickable area that closes it. So the content of the DIV above would change to something like this:

<div id="myAd">
<div style="float:right;"><span onclick="document.getElementById('myAd').style.display='none';">Close me</span></div>
<img src="images/myFantasticImage.gif" />
</div>

I haven't tested this but I'm reasonably confident that it's cross-browser and will work. Hopefully it will at least point you in the right direction.

Good luck with it.

Regards,


David