I am trying to use the start button to pull up a new screen with another button. This is the code I am using (minus the background URLs).
<button type="button" onclick="myFunction()">Start</button>
<script>
function myFunction() {
document.body.style.backgroundColor = "#f3f3f3";
document.body.style.backgroundImage = "url('example')";
<button type="button" onclick="NewFunction()">Other</button>
}
<script>
function NewFunction(){
document.body.style.backgroundImage = "url('example2')"
}
</body>
</html>
I have tried using an if statement to determine if myFunction has been executed, and adding the button if the conditions are met.
3
Answers
Not sure what you want, but…
Example 1: Takes the static div on the dom from the id and changes the inner HTML to the button.
Example 2: Creates a new element with the features you want, then appends it to the dom at your desired div’s id
This is the approach I would take: