Forum Moderators: coopster
the table rows are hyperlinks which i think is the main issue, but typically with hyperlinks you can drag mouse cursor over the text and copy with ctrl+c
the scripts builds the table rows like this -
echo"<a href=\"viewconnectors.php?company_name=".urlencode($myrow['company_name'])."&filter_by=".urlencode($_POST['filter_by'])."\"><tr style=\"cursor:hand\" bgcolor=\"#F0F0F0\" onMouseOver=\"this.bgColor = 'white'\" onMouseOut =\"this.bgColor = '#F0F0F0'\" >";
Is there another way i can make the table rows as hyperlinks but have the ability to copy the text
Usually one uses links like following:
<a href="http://www.example.com">Example.com Website</a>
if this did not help, maybe you could illustrate the problem a bit more.
echo"<a href=\"viewconnectors.php?company_name=" . urlencode($myrow['company_name']) . "&filter_by=" . urlencode($_POST['filter_by']) . "\"><tr style=\"cursor:hand\" bgcolor=\"#F0F0F0\" onMouseOver=\"this.bgColor = 'white'\" onMouseOut =\"this.bgColor = '#F0F0F0'\" >";
It doesn't look as if you are outputting valid HTML. The anchor (inline element) cannot contain <tr> (block-level) elements. Your anchor needs to be inside your <td> elements. If the HTML is not valid then browser behaviour is going to be unpredictable. Your ampersands (query string separator) also need to be encoded as & to validate.
<hyperlink><tr>
<td>
<td>
<td>
<td>
<td>
</tr></hyperlink>
It works, the whole table row is a hyperlink, i need to tell the cursor to be a hand when i hover over it but the link works, the question is why will it not allow me to copy the contents of the row or even highlight it, it seems treat the row almost like an image
It works, the whole table row is a hyperlink, i need to tell the cursor to be a hand when i hover over it but the link works, the question is why will it not allow me to copy the contents of the row or even highlight it, it seems treat the row almost like an image
I think you need to test it a bit more. 'It works' in IE6/7 so much as the href is followed, but as you have found you can't select the text, nor does it visually behave like an anchor. It does not work at all in Firefox, Opera or Safari. Probably because it is not valid HTML and this is also stated in the thread above.
An HTML issue really... I don't think you can reasonably start to figure out why something isn't working when the HTML itself is invalid. Step 1 - valid HTML. (W3C HTML Validator [validator.w3.org])
(IE sometimes prevents the selection of text when certain elements have been left open. The <base> element is a common problem in this respect.)
You may want to assign an onclick event to the <tr> element instead. You can keep an anchor (for SEO and non-JavaScript users?), but this will need to go inside a <td>. You could use JS to automatically assign the onclick event based on the anchor inside the row?
NB:
cursor:handis again IE only. You need to use
cursor:pointerfor cross-browser compatibility. Also bgcolor is a deprecated attribute, so you may want to consider using CSS
background-colorinstead.