Jump to content

Dynamicly Change Background


Recommended Posts

Hi All! 

 

I used a solution from the How-To for changing background, but the script seems doesn't work for me:

 

 

 
 
Code from the html block below all the fields:
[@field:Sale_Location_State]
<a id="visi[@field:ID]">
<script>var isi = document.getElementByID("visi[@field:ID]");if('[@field:Sales]' >=1000){isi.parentNode.parentNode.style.backgroundColor = 'green';}else{isi.parentNode.parentNode.style.backgroundColor = 'red';}</script>
 
</a>
Link to comment
Share on other sites

Hi Michelle,

 

As far as I can see, you use solution from here

 

I don't see code from the first html block/ Please make sure, that you have added the following code to the html block before all the fields:

<div id="visi[@field:ID]">

Also I see that you've made a mistake in the syntax: you should use: getElementById instead of getElementByID

And there is no closing div tag.

 

I've edited your code:

 

</div>

<script>var isi = document.getElementById("visi[@field:ID]");if('[@field:Sales]' >=1000){isi.parentNode.parentNode.style.backgroundColor = 'green';}else{isi.parentNode.parentNode.style.backgroundColor = 'red';}</script>

Hope it helps

Link to comment
Share on other sites

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