www.webdeveloper.com
Results 1 to 4 of 4

Thread: CSS Image Link Help

  1. #1
    Join Date
    Jan 2010
    Posts
    51

    CSS Image Link Help

    Hi,

    I have a css image header backgound which i linked using the following code and it works in IE - http://slouchmat.co.uk/products.htm - if you click on the header it takes you back to the homepage

    however it does not work in Firefox

    The code: -

    <div id="logo"onclick="window.location('http://slouchmat.co.uk/index2.htm')"></div>

    #logo {
    position: absolute;
    width: 980px;
    height: 188px;
    background-image: url('...images/header.jpg');
    background-repeat: no-repeat;
    background-position: center center;
    cursor: pointer;
    }

    any help

  2. #2
    Join Date
    Mar 2011
    Posts
    1,156
    The debugger says "windows.location is not a function". Try:
    Code:
    <div id="logo"onclick="window.location.href='http://slouchmat.co.uk/index2.htm';"></div>
    I can never remember the best way to do this for cross-browser compatibility, so you may also have to try "window.location", "document.location", and "document.location.href", but the principle is the same.

  3. #3
    Join Date
    May 2005
    Location
    Gold Coast (MS)
    Posts
    2,219
    Sometimes not having a space where one is expected can cause problems. Maybe this one?: logo"onclick Or, is it just a typo here?

  4. #4
    Join Date
    Mar 2009
    Posts
    452
    you can also put your div inside in a tag. otherwise you can simply use onclick="location='http://slouchmat.co.uk/index2.htm';"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles