The first function called fillBoxes() will make the input fields = “Hello World” as you can see in the picture.
document.getElementById(‘field_493’).value = “Hello”
This line searches the document for an element with the id=“field_493” and changes its value to “Hello”.
The getElementById function requires a string parameter to work, in this case being “field_493”.
Most HTML document elements, whether a button, a picture, a string, have an id/class/name that you can fill such a parameter with. You can investigate this by right clicking the website and clicking “Inspect Element” (Chrome/FireFox) or “View Source” (Internet Explorer).
window.onload = function()
which will accept a string as a parameter to display in the alert window.
We go into our single template singletemplate.png, clicking the ‘<>’ in the editor, and add tags in HTML to create a button on our single template page. We also add the event “onclick” so when the button is clicked, the function “button()” is run. There are tons of events supported by various tags, like “onhover”, “ondoubleclick”, which you can easily google.
Now, as in the file buttonpopup.jpg when we go to our single template, there should be a button, which when clicked will run button(), displaying an alert box.