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

Newbie w/Character Sheets: Sandbox ignoring my javascript?

Sorry, I don't know what I'm doing. My javascript is being ignored when I upload this html... any suggestions? <!doctype html> <html> <head> <meta charset="UTF-8"> <title>Untitled Document</title> <script> function updateModifiers() { // convert ability scores to modifiers var strScore = document.getElementById("strScore").value; var dexScore = document.getElementById("dexScore").value; document.getElementById("strMod").value = Math.floor((strScore-10)/2) document.getElementById("dexMod").value = Math.floor((dexScore-10)/2) } </script> </head> <body> <div id="pageContainer"> <table> <tr> <th>Ability</th> <th>Score</th> <th>Modifier</th> </tr> <tr> <td> STR </td> <td> <input type="number" value=10 placeholder=10 id="strScore" onchange="updateModifiers()"> </td> <td> <input type="number" placeholder=0 id="strMod"> </td> </tr> <tr> <td> DEX </td> <td> <input type="number" value=10 id="dexScore"> </td> <td> <input type="number" placeholder=0 id="dexMod"> </td> </tr> <tr> <td> CON </td> <td> <input type="number" value=10 id="conScore"> </td> <td> <input type="number" placeholder=0 id="conMod"> </td> </tr> <tr> <td> INT </td> <td> <input type="number" placeholder=10 id="intScore"> </td> <td> <input type="number" placeholder=0 id="intMod"> </td> </tr> <tr> <td> WIS </td> <td> <input type="number" value=10 id="wisScore"> </td> <td> <input type="number" placeholder=0 id="wisMod"> </td> </tr> <tr> <td> CHR </td> <td> <input type="number" value=10 id="chrScore"> </td> <td> <input type="number" placeholder=0 id="chrMod"> </td> </tr> </table> <h2> Level </h2> <input type="number" placeholder=1 id="level" min=1 max=20> <h2> Proficiency Bonus </h2> <input type="number" placeholder=0 id="profBonus"> </div> </body> </html>
1607950146
Finderski
Pro
Sheet Author
Compendium Curator
Sheet workers don't have access to the DOM and character sheets shouldn't use element IDs. This link will give you what you need to know about implementing sheet workers.&nbsp;<a href="https://wiki.roll20.net/Sheet_Worker_Scripts" rel="nofollow">https://wiki.roll20.net/Sheet_Worker_Scripts</a>
Yeah I misred the tutorial... it was just an html/css/javascript character sheet tutorial. First result on a search for "roll20 custom character sheets." I can't actually find any video tutorials which would be the most helpful for me. Oh well, thanks for your advice.
1607965208
vÍnce
Pro
Sheet Author
Hi Thorin, Just to add; you'll find that roll20 requires special handling for html/css/js.&nbsp; Definitely have a read over the Building Character Sheets on wiki .&nbsp; That should help overcome a few headaches as you progress on your sheet.&nbsp; Post back with questions as needed.&nbsp; Lots of helpful/knowledgeable people here.&nbsp; Cheers
1607970525
Andreas J.
Forum Champion
Sheet Author
Translator
Yeah, Vince linked to the definitive guide. It has a "Restrictions", "Common Mistakes" and "Complete Examples" section that shows what the code for a roll20 sheet looks like. The two major issues with you code(which is also explained in the guide): the sheet code should only be what's inside the body element, so you must remove the extra stuff or nothing will work all attirbutes must have a name tag or nothing will be saved on the sheet. and the name must have an "attr_" prefix, so your STR section could look like: &lt;input type="number" value=10 placeholder=10 name="attr_strScore"&gt;