en:user:gs3_sample_format_statements
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
en:user:gs3_sample_format_statements [2016/10/09 22:51] – [Using javascript to change the display] kjdon | en:user:gs3_sample_format_statements [2016/10/09 23:05] – [Using the javascript in the format statement] kjdon | ||
---|---|---|---|
Line 234: | Line 234: | ||
< | < | ||
- | | + | < |
- | <td valign=" | + | <td valign=" |
- | | + | < |
- | | + | < |
- | | + | </ |
- | </ | + | </ |
- | <td valign=" | + | <td valign=" |
- | < | + | < |
- | </ | + | </ |
- | < | + | < |
- | < | + | < |
- | </ | + | </ |
- | </ | + | </ |
</ | </ | ||
Line 255: | Line 255: | ||
< | < | ||
<td> | <td> | ||
- | <script type=" | + | <script type=" |
+ | </ | ||
</td> | </td> | ||
</ | </ | ||
+ | |||
+ | This lets us check that our function is correct and we are getting the right metadata. However, using " | ||
+ | |||
+ | Instead, we will need to set the innerHTML of the td element. This means we need to give the td element an id so we can find it again. | ||
+ | |||
+ | < | ||
+ | <td> | ||
+ | < | ||
+ | <script type=" | ||
+ | document.getElementById(< | ||
+ | </ | ||
+ | </td> | ||
+ | </ | ||
+ | |||
+ | Element ids need to be unique, so in this case we will use the document id (< | ||
+ | <td id="< | ||
+ | |||
+ | To set an element' | ||
+ | document.getElementById finds the specified element, and element.innerHTML = " | ||
+ | |||
+ | We set the text to be the result of calling our function on the filesize metadata. | ||
+ | |||
+ | One further tricky part. We want to write document.getElementById("< | ||
+ | |||
+ | i.e. document.getElementById(< | ||
+ | |||
+ | Greenstone provides a shorthand: < | ||
en/user/gs3_sample_format_statements.txt · Last modified: 2024/07/05 01:00 by kjdon