I am new to programming and would really appreciate any help. This is also my first post, so please excuse me if I am doing this wrong as well. I have an html page with a table that gets its values from an array function in php. I need to change the text Monday to Red which I can do, but it only formats the first row. Here is what I have
if ($result->num_rows > 0) {
echo "<table><tr><th>Assessor</th><th>Activity</tr>";
while($row = $result->fetch_assoc()) {
echo "<tr><td>" . $row['first_name']. "</td><td id='Activity' class = 'Activity'>" .
$row['Activity']. "</td></tr>";
}
echo "</table>";
} else {
echo "0 results";
}
and here is the JavaScript code:
function changeSubStringColorT() {
var str = document.getElementById("Activity").innerHTML;
var resT = str.replace("Monday", "<span style='color:blue; font-weight:bold' >Monday</span>");
document.getElementById("Activity").innerHTML = resT;
If I change the getElementById it works, but only the first row. If I change to get ElementsBy ClassName it doen nothing.
I have changed the class of the <td class="Activity" but nothing happens. I have no idea where to look or what to do. Thanks alot guys, this site has helped me a lot since I started
idattributes (when there are more than one lines in your table). This will be invalid HTML..