Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Trouble with

Hi all.  I'm pretty green with html and all. I've got a number of <select> drop down menus that work well enough, passing the selected value to attributes that I use in my api scripts. Today I was trying to get a little fancier and make each option a different color that changed the color of the selected value.  For the life of me I could not get this to work, and it seems like my onchange events are not triggering my scripts.  Is there any whole-sale reason why this method won't work? The following code is a little jumbled cause I'm trying everything I can find all at once.  Also, I'm trying to change the value of the attribute via these scripts as a test because I actually log that.  The scripts below do not alter the selected value, its always the value of the selected option. <select style="color:brown;font-weight:bold;width:80px" id = "elemSel2" onchange="dropDownChange5(this.style.color)" name="attr_soulElem">                   <option style="color:brown;font-weight:bold" selected = "selected" value="0">Solid</option>                   <option style="color:blue;font-weight:bold" value="1">Flow</option>                   <option style="color:pink;font-weight:bold" value="2">Life</option>                   <option style="color:red;font-weight:bold" value="3">Radiant</option>                   <option style="color:green;font-weight:bold" value="4">Scatter</option>                   <option style="color:black;font-weight:bold" value="5">Void</option>                 </select> <script>        function dropDownChange5(thisColor){                    thisColor = "blue"        }  </script> <script> document.getElementById("elemSel2").onchange = function() {myFunction()}; function myFunction() {     document.getElementById("elemSel2").style.color = "blue";     var x = document.getElementById("elemSel2");     x.value = "-1"     var attrName = x.name     attrName.set("current",-1)     x.style.color = "blue"     } </script>
1511656591

Edited 1511656676
You have to structure your sheetworker code based on events. The dom and IDs are not available for use. See the wiki here: <a href="https://wiki.roll20.net/Sheet_Worker_Scripts" rel="nofollow">https://wiki.roll20.net/Sheet_Worker_Scripts</a> and here: <a href="https://wiki.roll20.net/Building_Character_Sheets#" rel="nofollow">https://wiki.roll20.net/Building_Character_Sheets#</a>...
Thank you.&nbsp; &nbsp;Man I kinda rushed out the door when I posted this and didn't realize how poorly titled my post was.&nbsp; Thanks for the heads up.