please help with code
Results 1 to 4 of 4

Thread: please help with code

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Posts
    2

    please help with code

    Hi,
    im having trouble adding a link to a image.
    I can get the image, I can get the link but I cant get both at the same time.

    he is the code I have

    <? if($TeamLocalScore01 != '') {echo "<td width='50' valign='middle' align='center' background='../images/nhl_logo86/Result.gif' <a href='/Archives/2013-2014-RegularSeason/QNHL8-$Game01.html'>FINAL</a>"; }?>

    I want the script to add a background image and then have the Text FINAL appear over the image ( Final will be the link to another page)

    what am I doing wrong in my code
    thanks for your help

  2. #2
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Systems Vehicle "Thrilled To Be Here"
    Posts
    21,844
    Well, for one thing you're using antiquated HTML attributes to do your styling instead of CSS. For another, you're trying to put an <a> element inside the opening tag of a <td> element.
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

  3. #3
    Junior Member
    Join Date
    Oct 2013
    Posts
    2
    <? if($TeamLocalScore01 != '') {echo "<td width='50' valign='middle' align='center' background='../images/nhl_logo86/Result.gif' </td><a href='/Archives/2013-2014-RegularSeason/QNHL8-$Game01.html'>FINAL</a>"; }?>

    just adding a </td> made it work but I did look into the css and I did this

    #BoxscoreDiv {
    height:29px;
    width:50px;
    background-image: url(../images/nhl_logo86/Result.gif);
    background-position:center;
    background-size:auto;
    font-family:Arial, Helvetica, sans-serif;
    font-size:12px;
    font-weight:bold;
    line-height:29px;
    text-align:center;
    vertical-align:middle;

    }

    <? if($TeamLocalScore02 != '') {echo "<div id='BoxscoreDiv' </div><a href='/Archives/2013-2014-RegularSeason/QNHL8-$Game02.html'>FINAL</a>"; }?>

    seems to be doing what I want

    thanks for the help and pointing me in a good direction

    is what I did with css ok ?

  4. #4
    Senior Member
    Join Date
    Jul 2007
    Posts
    3,637
    The css, possibly, but your html markup is screwed up and invalid. See http://validator.w3.org for validation of html code. For example
    [hmtl]
    <td>...</td><a>...</a>
    [html]
    Can never ever ever be ok, since td is only allowed to appear inside a tr element, which in turn can never contain any other children than td or th.

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
  •