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

issue with checkboxes

Hi I'm trying to create my own game on roll20 and for that I created my own character sheet. As I use differents sheets for player and non-players, I putted all on one single html file, each sheet can be shown with a checkbox. But when I try on a character sheet sandbox, it doesn't work anymore : all stay hidden... I don't know why, that's why I'm asking for your help. here's my code so far <h1 style="text-align: center;"><span style="color: #ff0000;">Les Légendes de Balésia</span></h1> <hr /> <input type="checkbox" name="attr_pj" id="choix1" onclick="checkMe()">PJ <input type="checkbox" name="attr_pnj" id="choix2" onclick="checkMe()">PNJ <input type="checkbox" name="attr_autre" id="choix3" onclick="checkMe()">Autre <div id="PJ_sheet" style="display:none"> <p> Nom <input name="attr_character_name" type="text" /><br /> Race <input name="attr_Race" type="text" /> Rang <input name="attr_Rang" type="text" /> Niveau <input name="attr_Niveau" type="number" /><br /> Pays <input name="attr_Pays" type="text" /> Province <input name="attr_Province" type="text" /> Ville <input name="attr_Ville" type="text" /><br /> Date <input name="attr_Date" type="text" /><br /> Taille <input name="attr_Taille" type="text" /> Poids <input name="attr_Poids" type="text" /> Age <input name="attr_Age" type="text" /> </p> <hr /> <h3>CARACTERISTIQUES</h3> <table style="border-collapse: collapse; width: 100%;" border="1"> <tbody> <tr> <td style="width: 50%;"> <input name="attr_Attaque" type="number" /> <button name="" type="roll" value="Attaque : [[1d20+@{Attaque}]]">ATTAQUE</button></td> <td style="width: 50%;"> <input name="attr_Défense" type="number" /> <button name="" type="roll" value="Défense : [[1d20+@{Défense}]]">DEFENSE</button></td> </tr> <tr> <td style="width: 50%;"> <input name="attr_Vie" type="number" /> <button name="" type="roll" value="Vie : [[1d20+@{Vie}]]">VIE</button></td> <td style="width: 50%;"> <input name="attr_Arcane" type="number" /> <button name="" type="roll" value="Arcane : [[1d20+@{Arcane}]]">ARCANE</button></td> </tr> <tr> <td style="width: 50%;"> <input name="attr_Corps" type="number" /> <button name="" type="roll" value="Corps : [[1d20+@{Corps}]]">CORPS</button></td> <td style="width: 50%;"> <input name="attr_Esprit" type="number" /> <button name="" type="roll" value="Esprit : [[1d20+@{Esprit}]]">ESPRIT</button></td> </tr> <tr> <td style="width: 50%;"> <input name="attr_Perception" type="number" /> <button name="" type="roll" value="Perception : [[1d20+@{Perception}]]">PERCEPTION</button></td> <td style="width: 50%;"> <input name="attr_Réaction" type="number" /> <button name="" type="roll" value="Réaction : [[1d20+@{Réaction}]]">REACTION</button></td> </tr> </tbody> </table> <hr /> <p> VITALITE <input name="attr_Vitalité" type="number" /> <input name="attr_VitalitéTemporaire" type="number" /> <input name="attr_Vitalité_max" type="number" /><br /> EPUISEMENT <input name="attr_Epuisement" type="number" /> <input name="attr_EpuisementTemporaire" type="number" /> <input name="attr_Epuisement_max" type="number" /> </p> <hr /> <h3>ARGENT</h3> <p> EV <input name="attr_EclatVegaline" type="number" /> EP <input name="attr_EclatPlatine" type="number" /> ED <input name="attr_EclatDiamant" type="number" /><br /> EO <input name="attr_EclatOr" type="number" /> EA <input name="attr_EclatArgent" type="number" /> EC <input name="attr_EclatCuivre" type="number" /> </p> <hr /> <h3>CAPACITES</h3> <p> <label for="attr_capa1">Capacités raciales</label> </p> <select id="attr_capa-select" name="attr_capacite"> <option value="">--Choisissez une option--</option> <option value="Artificiel">Artificiel</option> <option value="Balayage">Balayage</option> <option value="BoucEmissaire">Bouc-Emissaire</option> <option value="Charge">Charge</option> <option value="Charme">Charme</option> <option value="Dard">Dard</option> <option value="Eveillé">Eveillé</option> <option value="Intrus">Intrus</option> <option value="Métamorphose">Métamorphose</option> <option value="Monture">Monture</option> <option value="Nyctalopie">Nyctalopie</option> <option value="Petit">Petit</option> <option value="Poison">Poison</option> <option value="Rage">Rage</option> <option value="Rationaliste">Rationaliste</option> <option value="Solide">Solide</option> <option value="Souffle">Souffle</option> <option value="Téléportation">Téléportation</option> <option value="Toxique">Toxique</option> <option value="Vol">Vol</option> </select> <select id="attr_capa-select2" name="attr_capacite2"> <option value="">--Choisissez une option--</option> <option value="Artificiel">Artificiel</option> <option value="Balayage">Balayage</option> <option value="BoucEmissaire">Bouc-Emissaire</option> <option value="Charge">Charge</option> <option value="Charme">Charme</option> <option value="Dard">Dard</option> <option value="Eveillé">Eveillé</option> <option value="Intrus">Intrus</option> <option value="Métamorphose">Métamorphose</option> <option value="Monture">Monture</option> <option value="Nyctalopie">Nyctalopie</option> <option value="Petit">Petit</option> <option value="Poison">Poison</option> <option value="Rage">Rage</option> <option value="Rationaliste">Rationaliste</option> <option value="Solide">Solide</option> <option value="Souffle">Souffle</option> <option value="Téléportation">Téléportation</option> <option value="Toxique">Toxique</option> <option value="Vol">Vol</option> </select> <p> <input name="attr_Capa1" type="text" /> <input name="attr_Capa2" type="text" /><br /> <input name="attr_Capa3" type="text" /> <input name="attr_Capa4" type="text" /><br /> <input name="attr_Capa5" type="text" /> <input name="attr_Capa6" type="text" /> </p> <hr /> <h3>INVENTAIRE</h3> <p> <label for="attr_inventaire"></label> <textarea id="attr_inv" cols="30" name="attr_Inventaire" rows="6"> </textarea> </p> <h3>NOTES</h3> <p> <label for="attr_notes"></label> <textarea id="attr_notes" cols="30" name="attr_notes" rows="6"> </textarea> </p> </div> <div id="PNJ_sheet" style="display:none"> <p> Nom <input name="attr_character_name" type="text" /><br /> Race <input name="attr_Race" type="text" /> Rang <input name="attr_Rang" type="text" /> Niveau <input name="attr_Niveau" type="number" /><br /> Pays <input name="attr_Pays" type="text" /> Province <input name="attr_Province" type="text" /> Ville <input name="attr_Ville" type="text" /><br /> Date <input name="attr_Date" type="text" /><br /> Taille <input name="attr_Taille" type="text" /> Poids <input name="attr_Poids" type="text" /> Age <input name="attr_Age" type="text" /> </p> <hr /> <h3>CARACTERISTIQUES</h3> <table style="border-collapse: collapse; width: 100%;" border="1"> <tbody> <tr> <td style="width: 50%;"> <input name="attr_Attaque" type="number" /> <button name="" type="roll" value="Attaque : [[1d20+@{Attaque}]]">ATTAQUE</button></td> <td style="width: 50%;"> <input name="attr_Défense" type="number" /> <button name="" type="roll" value="Défense : [[1d20+@{Défense}]]">DEFENSE</button></td> </tr> <tr> <td style="width: 50%;"> <input name="attr_Vie" type="number" /> <button name="" type="roll" value="Vie : [[1d20+@{Vie}]]">VIE</button></td> <td style="width: 50%;"> <input name="attr_Arcane" type="number" /> <button name="" type="roll" value="Arcane : [[1d20+@{Arcane}]]">ARCANE</button></td> </tr> <tr> <td style="width: 50%;"> <input name="attr_Corps" type="number" /> <button name="" type="roll" value="Corps : [[1d20+@{Corps}]]">CORPS</button></td> <td style="width: 50%;"> <input name="attr_Esprit" type="number" /> <button name="" type="roll" value="Esprit : [[1d20+@{Esprit}]]">ESPRIT</button></td> </tr> <tr> <td style="width: 50%;"> <input name="attr_Perception" type="number" /> <button name="" type="roll" value="Perception : [[1d20+@{Perception}]]">PERCEPTION</button></td> <td style="width: 50%;"> <input name="attr_Réaction" type="number" /> <button name="" type="roll" value="Réaction : [[1d20+@{Réaction}]]">REACTION</button></td> </tr> </tbody> </table> <hr /> <p> VITALITE <input name="attr_Vitalité" type="number" /> <input name="attr_VitalitéTemporaire" type="number" /> <input name="attr_Vitalité_max" type="number" /><br /> EPUISEMENT <input name="attr_Epuisement" type="number" /> <input name="attr_EpuisementTemporaire" type="number" /> <input name="attr_Epuisement_max" type="number" /> </p> <hr /> <h3>ARGENT</h3> <p> EV <input name="attr_EclatVegaline" type="number" /> EP <input name="attr_EclatPlatine" type="number" /> ED <input name="attr_EclatDiamant" type="number" /><br /> EO <input name="attr_EclatOr" type="number" /> EA <input name="attr_EclatArgent" type="number" /> EC <input name="attr_EclatCuivre" type="number" /> </p> <hr /> <h3>INVENTAIRE</h3> <p> <label for="attr_inventaire"></label> <textarea id="attr_inv" cols="30" name="attr_Inventaire" rows="6"> </textarea> </p> <h3>NOTES</h3> <p> <label for="attr_notes"></label> <textarea id="attr_notes" cols="30" name="attr_notes" rows="6"> </textarea> </p> </div> <div id="other_sheet" style="display:none"> <p> Nom <input name="attr_character_name" type="text" /><br /> Race <input name="attr_Race" type="text" /> Niveau <input name="attr_Niveau" type="number" /><br /> Taille <input name="attr_Taille" type="text" /> Poids <input name="attr_Poids" type="text" /> </p> <hr /> <h3>CARACTERISTIQUES</h3> <table style="border-collapse: collapse; width: 100%;" border="1"> <tbody> <tr> <td style="width: 50%;"> <input name="attr_Attaque" type="number" /> <button name="" type="roll" value="Attaque : [[1d20+@{Attaque}]]">ATTAQUE</button></td> <td style="width: 50%;"> <input name="attr_Défense" type="number" /> <button name="" type="roll" value="Défense : [[1d20+@{Défense}]]">DEFENSE</button></td> </tr> <tr> <td style="width: 50%;"> <input name="attr_Vie" type="number" /> <button name="" type="roll" value="Vie : [[1d20+@{Vie}]]">VIE</button></td> <td style="width: 50%;"> <input name="attr_Arcane" type="number" /> <button name="" type="roll" value="Arcane : [[1d20+@{Arcane}]]">ARCANE</button></td> </tr> <tr> <td style="width: 50%;"> <input name="attr_Corps" type="number" /> <button name="" type="roll" value="Corps : [[1d20+@{Corps}]]">CORPS</button></td> <td style="width: 50%;"> <input name="attr_Esprit" type="number" /> <button name="" type="roll" value="Esprit : [[1d20+@{Esprit}]]">ESPRIT</button></td> </tr> <tr> <td style="width: 50%;"> <input name="attr_Perception" type="number" /> <button name="" type="roll" value="Perception : [[1d20+@{Perception}]]">PERCEPTION</button></td> <td style="width: 50%;"> <input name="attr_Réaction" type="number" /> <button name="" type="roll" value="Réaction : [[1d20+@{Réaction}]]">REACTION</button></td> </tr> </tbody> </table> <hr /> <p> VITALITE <input name="attr_Vitalité" type="number" /> <input name="attr_VitalitéTemporaire" type="number" /> <input name="attr_Vitalité_max" type="number" /><br /> EPUISEMENT <input name="attr_Epuisement" type="number" /> <input name="attr_EpuisementTemporaire" type="number" /> <input name="attr_Epuisement_max" type="number" /> </p> <hr /> <h3>ARGENT</h3> <p> EV <input name="attr_EclatVegaline" type="number" /> EP <input name="attr_EclatPlatine" type="number" /> ED <input name="attr_EclatDiamant" type="number" /><br /> EO <input name="attr_EclatOr" type="number" /> EA <input name="attr_EclatArgent" type="number" /> EC <input name="attr_EclatCuivre" type="number" /> </p> <h3>CAPACITES</h3> <p> <label for="attr_capacite_others"></label> <textarea id="attr_capa_others" cols="30" name="attr_Capacite_others" rows="6"> </textarea> </p> <h3>INVENTAIRE</h3> <p> <label for="attr_inventaire"></label> <textarea id="attr_inv" cols="30" name="attr_Inventaire" rows="6"> </textarea> </p> </div> <script> function checkMe(){ let check1 = document.getElementById("choix1"); let check2 = document.getElementById("choix2"); let check3 = document.getElementById("choix3"); let player = document.getElementById("PJ_sheet"); let chara = document.getElementById("PNJ_sheet"); let monster = document.getElementById("other_sheet"); if(check1.checked){ player.style.display="block"; } else { player.style.display="none"; } if(check2.checked){ chara.style.display="block"; } else { chara.style.display="none"; } if(check3.checked){ monster.style.display="block"; } else { monster.style.display="none"; } } </script>
1677425945

Edited 1677426023
GiGs
Pro
Sheet Author
API Scripter
First rule of Roll20: Make sure you aren't following advice from sites that aren't built for roll20. This onclick="checkMe() will not work on Roll20. There might be other issues, I havent looked deeply at your code. Never mind, I scrolled down. This won't work either: let check1 = document.getElementById("choix1"); Scripts on roll20 can not modify the document object model (you can't use javascript to reshape the page): the only javasccipt that is allowed is changing the values of attributes. You can use this in combination with CSS to change what is visible. Here's a guide: <a href="https://cybersphere.me/hiding-and-revealing-things-with-css/" rel="nofollow">https://cybersphere.me/hiding-and-revealing-things-with-css/</a> There's a page on the wiki covering it as well, but it's a bit harder to follow i think. I'd also recommend looking into CSS Grid as an alternative to using tables for layout. It's actually easier. <a href="https://cybersphere.me/css-grid/" rel="nofollow">https://cybersphere.me/css-grid/</a>