Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 2nd, 2005, 06:34 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default style on a td to make it look like a button

I have a <td> cell inside a table.

Is there anyway to put a style on it to make it appear as a button or something that looks like it needs to be pressed?

TIA.

Picco

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old September 2nd, 2005, 07:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You can try something like this...
Code:
<html>
<head>
<style>
    table        { font-family:verdana; font-size:8pt; }
    td.contents    { border:solid 1px #dddddd; padding:5px; }
    td.button    { border:outset 1px #bbbbbb; padding:5px; cursor:pointer; cursor:hand; }
    ul            { margin:0px; margin-left:20px; padding-left:0px; }
</style>
<script language=javascript>
function toggle(sectionId)
{
    var color01 = "#555555";
    var color01rgb = "rgb(85, 85, 85)";
    var color02 = "#eeeeee";
    var color02rgb = "rgb(238, 238, 238)";
    var field;        
    field = document.getElementById(sectionId);
    if(field != null)
    {
        field.style.backgroundColor = 
            (field.style.backgroundColor == color01 || field.style.backgroundColor == color01rgb)? color02 : color01;
        field.style.color = 
            (field.style.color == color01 || field.style.color == color01rgb)? color02 : color01;
    }
}    
</script>
</head>
<body>
<table border="0" cellspacing="5">
    <tr>
        <td class="contents" colspan="2">
        [list]
            <li>item 01</li>
            <li>item 02</li>
        </ul>
        </td>
    </tr>
    <tr>
        <td id="b1" 
            class="button" 
            style="color:#555555; background-color:#eeeeee;" 
            onmouseover="toggle('b1'); return false;" 
            onmouseout="toggle('b1'); return false;">button 01</td>
        <td id="b2" 
            class="button" 
            style="color:#555555; background-color:#eeeeee;" 
            onmouseover="toggle('b2'); return false;" 
            onmouseout="toggle('b2'); return false;">button 01</td>
    </tr>
</table>
</body>
</html>
But why don't you use the ordinary button (<input type="button" />)?

Jacob.
 
Old September 2nd, 2005, 08:29 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

LOL! Why do you have to do everything with a table, crmpicco?

I could be wrong,just guessing here, but I suspect those cells will contain links. So style the links to look like buttons and they don't have to be in a table. :)

http://yupapa.com
 
Old September 12th, 2005, 10:22 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

thanks jacob, that put me on the correct track! I thought it would be something to do with <style> tags

meow, its not possible to change the links to look like buttons i am afraid.

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
 
Old September 12th, 2005, 03:42 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

It isn't? Gosh, I had no idea! :D



--
http://yupapa.com
 
Old September 13th, 2005, 08:03 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

i'm lost now ;)

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
 
Old September 13th, 2005, 03:21 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Why? :)

--
http://yupapa.com
 
Old September 13th, 2005, 03:56 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try 'view source' on meow's page ;) Jacob.
 
Old September 15th, 2005, 06:33 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

works:

Code:

.border {border-color:#A3B8CF; border-width:3px; border-style:outset; font-size:9px; font-family: Verdana, Arial, Helvetica, sans-serif;}

<td class=border>
www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
 
Old September 16th, 2005, 12:34 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Sure does. So do these. :)

Which one is your table?

--
http://yupapa.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Make a image button as default submit button toshi ASP.NET 1.0 and 1.1 Basics 1 June 1st, 2006 05:25 AM
make textbox maximum length of <td> cell crmpicco Javascript How-To 0 October 19th, 2005 10:46 AM
Controls and button style Windows Xp TAVOSOFT Pro VB.NET 2002/2003 1 July 21st, 2004 08:28 AM
Controls and button style Windows XP TAVOSOFT VB.NET 1 June 12th, 2004 09:59 AM
Controls and Button style Windows Xp TAVOSOFT VB.NET 2002/2003 Basics 1 June 12th, 2004 08:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.