Jump to content

Conditional Background Color Change


Recommended Posts

Hello Senicholas, 

Try to implement it this way:

<script>
function f_color(){
var myVal = parseInt(document.getElementById('ID').value);
if (myVal > 7) {
document.getElementById('ID').style.color = "red";
}
}
document.getElementById('ID').onchange= f_color;
</script>
Link to comment
Share on other sites

  • 2 months later...

Hi senicholas,

If you use a Report DataPage, I hope the following JavaScript can help:

<SCRIPT LANGUAGE="JavaScript">
var elems = document.getElementsByTagName("td");
for (var i=0, m=elems.length; i<m; i++) {
if (elems[i].innerHTML>7)
  { elems[i].style.color="red";}
}
</SCRIPT>

The code checks all valaues and make the color "red", if the value is more than 7.

Link to comment
Share on other sites

  • 8 months later...
  • 4 years later...
  • 3 years later...

Hello! 

You can create a Calculated field and use Case When Formula to compare the fields. Then, apply a script in the Footer to highlight the column based on the result of the Calculated field.

To hide the Calculated field, you can use the code here:

 

Link to comment
Share on other sites

  • 5 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...