Jump to content

gcGERM16

Members
  • Posts

    3
  • Joined

  • Last visited

gcGERM16's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hello, I'm new to CSS / HTML / Java and new to Caspio. I have a data table with 9 columns, see below for the headings: ID, Name, Surname, Email, Mobile no., Genre, Score, Percentage Score, Rank I'd like to format Rank column (column 9) so that if the cell contains the text: Low - then the text becomes green and bold Mid - then the text becomes orange and bold High - then the text becomes red and bold I only want the formatting to apply to the "Risk" column. I've read your solution above but I can't get this to work. Using my table/data what would I change var line_id='[@field:id]'; to and what would I change var elems = line.getElementsByTagName("td") to make this work?
  2. Hi all, I'm quite new to Caspio and to digital stuff so please bare with me. I'm currently using the code below to format the 7th column of my table red, amber of green depending on the value in each cell. <SCRIPT LANGUAGE="JavaScript"> var elems = document.getElementsByTagName("td");for (var i=0, m=elems.length; i<m; i++) { if (elems[i].innerHTML=="Low") { elems[i].style.color="red";} if (elems[i].innerHTML=="Low") {elems[i].style.backgroundColor="lightpink"} if (elems[i].innerHTML=="Mid") { elems[i].style.color="orange";} if (elems[i].innerHTML=="Mid") {elems[i].style.backgroundColor="wheat"} if (elems[i].innerHTML=="High") { elems[i].style.color="green";} if (elems[i].innerHTML=="High") {elems[i].style.backgroundColor="LightGreen"}} </SCRIPT> However, whenever I sort the table results by clicking the column headings or try to move onto the next page of results (by using the arrow buttons at the bottom of the page) all of the formatting generated by the code above disappears. Currently this code is located in the footer. Does anyone know how to prevent this from happening?
×
×
  • Create New...