Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Background Color/Texture as a Link

    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
    Code:
    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

  • #2
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Location
    Cowboy Nation
    Posts
    2,179
    Thanks
    174
    Thanked 257 Times in 257 Posts
    not sure what you mean. Do you have a link to a site that does this?

  • #3
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Location
    Cowboy Nation
    Posts
    2,179
    Thanks
    174
    Thanked 257 Times in 257 Posts
    not sure if its possible, but you can try

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

  • #5
    New to the CF scene
    Join Date
    Jul 2008
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by jcdevelopment View Post
    not sure if its possible, but you can try

    Code:
    <body onclick="window.location('http://www.yahoo.com');">
    not sure if that would work though
    Didn't work, but thank you for helping.

  • #6
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    I'm not certain what you wanted to achieve here, but base on my understanding, this might help:
    Code:
    <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>
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #7
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Are you thinking of a link which is a block?
    Code:
    
    <!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>

  • #8
    Regular Coder
    Join Date
    May 2008
    Location
    Lost in Localhost...
    Posts
    702
    Thanks
    3
    Thanked 43 Times in 42 Posts
    Quote Originally Posted by jcdevelopment View Post
    not sure if its possible, but you can try

    Code:
    <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...

  • #9
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Quote Originally Posted by Millenia View Post
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •