SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    Who Me? JeremyL's Avatar
    Join Date
    Dec 1999
    Location
    Dallas, TX
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Make a whole table clickable...

    On google thier adword ads are 100% clickable inside the ad table. It apears to be javascript. How would this be accomplished to make 100% of a table clickable?

    Also I wanted to ad this into a text exchange script. How could this be added to an ad served offsite which has no access to putting javascript in the head of a page?

    Thanks

  2. #2
    SitePoint Enthusiast amrithsagar's Avatar
    Join Date
    Aug 2001
    Location
    India
    Posts
    76
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    use CSS and JavaScript

    I think this can be done using both JavaScript and CSS. I made use of dreamweaver for this.

    amy
    - - - - - - - - - - - - --
    <html>
    <head>
    <title>Untitled Document</title>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_goToURL() { //v3.0
    var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
    for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
    }
    //-->
    </script>
    <style type="text/css">
    <!--
    .hand {
    text-decoration: none;
    cursor: hand;
    }
    -->
    </style>
    </head>

    <body>
    <table width="75%" border="1" onClick="MM_goToURL('parent','www.url.com');return document.MM_returnValue" class="hand">
    <tr>
    <td colspan="3">&nbsp;</td>
    </tr>
    </table>
    </body>
    </html>

  3. #3
    Alt+F4= User Control ;-) rabmurdy's Avatar
    Join Date
    Mar 2002
    Location
    Ecosse
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This should work just the same:

    Code:
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <a href="#"><div>This text is clickable</div></a></table>


    Just put all your add content within the div tag.
    "If something is too hard,give it up. The moral my boy is too never try anything"
    "Just because I don't care doesn't mean I don't understand"

  4. #4
    Who Me? JeremyL's Avatar
    Join Date
    Dec 1999
    Location
    Dallas, TX
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rabmurdy
    This should work just the same:

    Code:
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
    <a href="#"><div>This text is clickable</div></a></table>


    Just put all your add content within the div tag.
    I tried that, but it made it impossible to make the Title a link and not the rest. If I put a href tag within the div tag, it breaks the div link.

    Hmmm, I wonder if that will break under any browsers and which ones. On one hand I can do it with javascript and since it will be called from another domain the javascript will be out of the head tag and could cause some issues with some browsers.

    On the other hand the css method is cleaner and requires no js, but it could also cause some issues in some browsers.
    Last edited by JeremyL; Mar 1, 2003 at 19:03.

  5. #5
    Alt+F4= User Control ;-) rabmurdy's Avatar
    Join Date
    Mar 2002
    Location
    Ecosse
    Posts
    398
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JeremyL
    I tried that, but it made it impossible to make the Title a link and not the rest. If I put a href tag within the div tag, it breaks the div link.


    The title on googles adds are just underlined as far as I can see, the add box has a css style of no underline. Do you have a link to what your trying to do?
    "If something is too hard,give it up. The moral my boy is too never try anything"
    "Just because I don't care doesn't mean I don't understand"

  6. #6
    Who Me? JeremyL's Avatar
    Join Date
    Dec 1999
    Location
    Dallas, TX
    Posts
    296
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rabmurdy
    The title on googles adds are just underlined as far as I can see, the add box has a css style of no underline. Do you have a link to what your trying to do?
    I think I finally decided on the css div method with a onClick thrown in. This way, even if both javascript and css are disabled/unsupported, all the text in the table is clickable.

    Code:
    <table cellspacing=0 width="185" bgcolor=#b4d0dc border=0>
    <tbody>
    <tr>
    <td>
    <table cellspacing=0 cellpadding=3 width="100%" border=0>
    <tbody>
    <tr>
    <td bgcolor=#ecf8ff onMouseOver="ss('go to www.sitepoint.com')" onMouseOut=cs()> 
    <a href="http://www.sitepointforums.com">
    <div>
    <font style="font: 13px Arial, sans-serif; text-decoration: underline;">Site Point Forums<br>
    <font style="font: 10px Arial, sans-serif; color: #6f6f6f; text-decoration: none;">1st line here says something...<br>
    Then another line here.<br>
    And finally the last line WOW!<br>
    <font style="font: 13px Arial, sans-serif; color: Green; text-decoration: none;">www.sitepoint.com</font> 
    </font> 
    </font> 
    </div>
    </a> 
    </td>
    </tr>
    </tbody>
    </table>
    </td>
    </tr>
    </tbody>
    </table>
    Last edited by JeremyL; Mar 2, 2003 at 17:47.


Bookmarks

Posting Permissions

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