...

View Full Version : Background Color/Texture as a Link



blang
07-11-2008, 11:39 PM
Okay, I have seen some sites that do this. Basically, when the background wallpaper, or color is clicked it visits a link (normally in popunder form). How do i do this in css?

Here is my background code on my stylesheet

body{
font-family: Georgia, Verdana, Sans-serif;
background:url(images/back.jpg);

}

I was told I could do it using a Div. But I am confused and need help. Anyone?

Thanks

jcdevelopment
07-12-2008, 12:08 AM
not sure what you mean. Do you have a link to a site that does this?

blang
07-12-2008, 12:10 AM
I actually can't find one that isn't adult related at the moment.

But basically, i'm going to use these forums as an example.

See the white background on these forums? If someone clicks that background color I want it to link to something.

jcdevelopment
07-12-2008, 12:21 AM
not sure if its possible, but you can try



<body onclick="window.location('http://www.yahoo.com');">


not sure if that would work though

blang
07-12-2008, 01:09 AM
not sure if its possible, but you can try



<body onclick="window.location('http://www.yahoo.com');">


not sure if that would work though

Didn't work, but thank you for helping.

rangana
07-12-2008, 04:33 AM
I'm not certain what you wanted to achieve here, but base on my understanding, this might help:


<script type="text/javascript">
window.onload=function()
{document.getElementById('mydiv').onclick=function()
{location.href='http://www.google.com';}}
</script>
<div style="height:100px;width:300px;border:3px double #222;" id="mydiv">
Click Me
</div>

Apostropartheid
07-12-2008, 07:39 PM
Are you thinking of a link which is a block?


<!doctype html>
<style type="text/css">
* {
margin: 0;
padding: 0;
}
#blocklink {
background: #06c;
display: block;
height: 100px;
width: 100px;
}
</style>
<a id="blocklink" href="/miaow"></a>

Millenia
07-12-2008, 07:41 PM
not sure if its possible, but you can try



<body onclick="window.location('http://www.yahoo.com');">
not sure if that would work though


Didn't work, but thank you for helping.

I would have thought that would work...

Apostropartheid
07-12-2008, 07:57 PM
I would have thought that would work...
I'm thinking browsers don't allow a change of address for the body element, and no wonder; it must be really annoying.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum