This shows you the differences between two versions of the page.
Next revisionBoth sides next revision | |||
en:create:timer-countdown [16.07.2015 14:01] – created janisaltherr | en:create:timer-countdown [28.04.2021 17:43] – [Time display] sophia.schauer | ||
---|---|---|---|
Line 36: | Line 36: | ||
This code bit should be placed right at the top of the pages. Except for the first countdown page which needs the time definition code bit first (see above). | This code bit should be placed right at the top of the pages. Except for the first countdown page which needs the time definition code bit first (see above). | ||
- | ==== Time display | + | ==== Time Display |
- | While the participant fills out the pages inside the countdown, you might want them to see the remaining time. Additionally, | + | While the participant fills out the pages inside the countdown, you might want them to see the remaining time. Additionally, |
- | <code php> | + | Save the JavaScript code as text (Heading → Add text). For the content to be interpreted as JavaScript code, select "HTML code" as the representation. |
- | // Tell JavaScript | + | |
- | $timeLeft = $timeout - time(); | + | |
- | replace(' | + | |
- | text(' | + | |
- | </code> | + | |
- | + | ||
- | The actual JavaScript Code needs to be implemented | + | |
- | + | ||
- | Note the first two lines that do not contain Javascript yet, but simply | + | |
<code javascript> | <code javascript> | ||
Line 107: | Line 97: | ||
</ | </ | ||
</ | </ | ||
+ | |||
+ | **Tip:** If you do not want to display a message after the countdown has expired or do not want to automatically forward the participant, | ||
+ | |||
+ | **Tip:** Also note the first two lines, which do not yet contain JavaScript, but simply HTML code. This HTML code or another HTML element with the HTML ID " | ||
+ | |||
+ | To integrate the JavaScript code, a little PHP code is again required on the questionnaire page. The following PHP code passes the remaining time as placeholder '' | ||
+ | |||
+ | <code php> | ||
+ | // JavaScript to display remaining time | ||
+ | $timeLeft = $timeout - time(); | ||
+ | // Instead of JS01 the identifier of the text must be entered here | ||
+ | show(' | ||
+ | ' | ||
+ | )); | ||
+ | </ | ||
+ | |||
+ | This code is also needed on every page where the countdown should be displayed. | ||
+ | |||
+ | **Note:** For '' |