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...

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...
 Share

×
×
  • Create New...