PennController for IBEX › Forums › Support › html pages not showing
Tagged: html, javascript
- This topic has 4 replies, 2 voices, and was last updated 4 years ago by
vlanglois.
-
AuthorPosts
-
October 28, 2021 at 1:33 pm #7448
vlanglois
ParticipantHi,
I’m in the process of copying over some html pages that I’ve used in the old IbexFarm, but I noticed that the pages that I use javascript in don’t show up despite being included in the sequence (the otherlang and exit_screen html pages).
Here’s the demonstration link to the PCIbex formatted experiment: https://farm.pcibex.net/r/AFfjMK/
When using the old Ibex format, the pages do show up and work: https://farm.pcibex.net/r/THhfhS/
I’m not sure if it’s because PCIbex doesn’t recognize the functions, or maybe I messed up something in the main script and forgot a comma, but the pages should look like the one from the second demonstration link.
Thanks!
Val-
This topic was modified 4 years ago by
vlanglois.
October 28, 2021 at 4:11 pm #7451
JeremyKeymasterHi Val,
All three HTML pages you include using
newHtml(in the two trials labeled “demographics” and in the one labeled “exit_screen”) do show up in your experiment, but you have awaitcommand on the Button element only in the first trial, so the experiment rushes through the other twoYou can tell that all are included by looking at the Sequence tab of the debugger (once you reactivate it—it should only be turned off when you’re actively collecting data)
Jeremy
October 29, 2021 at 1:53 pm #7455vlanglois
ParticipantThanks! I figured it was something I was missing.
Is there anyway to hide certain elements when the page first loads? I have a couple of conditionals, which work when you click on “No” for the first question. It works correctly when loaded as a HTML page locally, but not when it is called within PCIbex. Is it because the button is interfering with the javascript?
November 2, 2021 at 1:10 pm #7464
JeremyKeymasterHi,
Add these two lines just after your SCRIPT tag:
const hideEm = ()=>{ if (document.getElementById("numlang")===null) return window.requestAnimationFrame(hideEm);and these two just before
function getVal(){:}; hideEm();This will make sure that the hiding commands will only be run after the elements were added to the page
Jeremy
November 3, 2021 at 11:37 am #7472vlanglois
ParticipantThanks! It worked perfectly.
-
This topic was modified 4 years ago by
-
AuthorPosts
- You must be logged in to reply to this topic.