Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Dreamweaver (all versions) 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
  #11 (permalink)  
Old August 2nd, 2004, 03:08 PM
amc amc is offline
Authorized User
 
Join Date: Feb 2004
Location: Barcelona, , Spain.
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes, Imar, it works, thanks. The only think I would like to have is to swap the cursor instead of the background color (tableRow.style.backgroundColor = 'yellow'). Might you please tell me how to do it?

thanks



thanks
antonio
  #12 (permalink)  
Old August 2nd, 2004, 07:09 PM
Friend of Wrox
 
Join Date: Jul 2004
Location: Tehran, , Iran.
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi antonio,
you can do it like below(without any javascript)
----
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
.dr {
    height: 100%;
    width: 100%;
    cursor: hand;
}
</style>
</head>
<body>
<table width="75%" border="1">
  <tr>
    <td><a href="#" class="dr">Mehdi</a></td>
    <td><a href="#" class="dr">Mehdi</a></td>
  </tr>

</table>
</body>
</html>
----

--------------------------------------------
Mehdi.
  #13 (permalink)  
Old August 3rd, 2004, 04:10 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi antonio,

You can modify the ChangeColor (and optionally give it a new name to reflect the new behavior) so it changes the cursor, like this:
Code:
function ChangeColor(tableRow, highLight)
    {
        if (highLight)
        {
           // tableRow.style.backgroundColor = 'yellow';
           tableRow.style.cursor = 'pointer';

        }
        else
        {
            // tableRow.style.backgroundColor = 'white';
            tableRow.style.cursor = 'default';
        }
    }
}
Mehdi: That wouldn't work, as it would just work when you hover over the content of each table cell, not the entire table row.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #14 (permalink)  
Old August 4th, 2004, 12:49 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: Tehran, , Iran.
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

yes Imar you are right,but there is not much difference between entire table row
and entire two table cells(the difference is because of borders)
I don't think it will be a good idea when you click borders you go to other pages...
anyway if border=0 this problem would be solved.

--------------------------------------------
Mehdi.:)
  #15 (permalink)  
Old August 4th, 2004, 01:06 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

There *is* a big difference, and it's not just about the borders. With an <a> around the content in the cell, just the content is linked. This means that if your content is 50 pixels wide, and your table column 100px, the 50 pixels to the right of the content is not linked. You can try it out:

<table width="600" border="1">
  <tr>
    <td width="300"><a href="#">123</a></td>
    <td width="300"><a href="#">234</a></td>
  </tr>
</table>

If you view this in a browser, just 123 and 234 are linked; not the rest of the whitespace in the table.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #16 (permalink)  
Old August 4th, 2004, 01:17 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: Tehran, , Iran.
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

Have a look at this one...(without any javascript!!!)
----
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style>
.dr {
    height: 100%;
    width: 100%;
    cursor: hand;
    border: 1px dotted #999999;
}
</style>
</head>
<body>
<table width="75%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td ><a href="#" class="dr">mehdi</a></td>
    <td > <a href="#" class="dr">mehdi</a></td>
  </tr>

</table>
</body>
</html>
----

--------------------------------------------
Mehdi.:)
  #17 (permalink)  
Old August 4th, 2004, 01:26 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: Tehran, , Iran.
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

>>This means that if your content is 50 pixels wide, and your table column 100px, >>the 50 pixels to the right of the content is not linked. You can try it out:
why at all in this way?!!! you should not have a 100px cell for a 50px content
hope you accept it.


--------------------------------------------
Mehdi.:)
  #18 (permalink)  
Old August 4th, 2004, 02:50 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
quote:why at all in this way?!!! you should not have a 100px cell for a 50px content
I am afraid I cannot accept that ;)

Suppose I have a table with a few rows. On row 1, column 1 has content that is 100 pixels wide. On row two, my content is only 50 pixels wide. Now, how wide is my entire column? 100 pixels, to accommodate for row 1. This means that in row 2 50 pixels of the table cell (next to the content) cannot be clicked as the whitespace is not hyperlinked. Other than that, for aesthetic reasons, I can also imagine a column being wider than the content it contains.
For a good example, look at the usernames of the posters on this page. There is a huge table cell, with only a small name. This means that if the name is hyperlinked, you can only click the name, and not the entire cell.

If I am not mistaken, that was the effect the OP was after. By linking the content you cannot achieve that effect; you'll need a way to link the entire cell or the entire row.

Cheers,

Imar
  #19 (permalink)  
Old August 4th, 2004, 05:21 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: Tehran, , Iran.
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

>>There is a huge table cell, with only a small name. This means that if the name >>is hyperlinked , you can only click the name, and not the entire cell.
but antonio didn't want it he wanted to act his entire cells as a HyperLink not just his Text.


--------------------------------------------
Mehdi.:)
  #20 (permalink)  
Old August 4th, 2004, 05:22 AM
Friend of Wrox
 
Join Date: Jul 2004
Location: Tehran, , Iran.
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

Imar,please don't consider all the situation at one time,it is better to separate them
suppose two situation
1-you know exactly all the widths of your cells(for example in the cells of a column you want to put some pictures with equal widths and also equal heights ).
----
<table width="600" border="1">
  <tr>
    <td width="300"><a href="#">123</a></td>
    <td width="300"><a href="#">234</a></td>
  </tr>
  <tr>
    <td width="300"><a href="#">123</a></td>
    <td width="300"><a href="#">234</a></td>
  </tr>
</table>
-----
2-you don't know the exact widths and heights of your cells so you don't have to determine the width and height of every cell in your column.
-----
<table width="600" border="1">
  <tr>
    <td a href="#">123</a></td>
    <td a href="#">234</a></td>
  </tr>
   <tr>
    <td a href="#">123</a></td>
    <td a href="#">234</a></td>
  </tr>
</table>
-----

--------------------------------------------
Mehdi.:)




Similar Threads
Thread Thread Starter Forum Replies Last Post
How to associate table rows with hyperlink?[READ] user0b PHP How-To 1 July 30th, 2008 04:20 AM
How to create a Hyperlink based on Cell Contents chatguy Excel VBA 4 October 15th, 2007 09:43 PM
layers in table cell dearmisskat HTML Code Clinic 12 March 10th, 2007 04:46 AM
reading from a table cell? Atomsk Access VBA 2 September 28th, 2006 07:46 AM





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