HTML problem help

I need help on the HTML language
I am new to coding, and I just created radio buttons by using HTML.
I want to press an answer and make a new screen pop up with a image of my choice

Does anybody know how to do that?

Hi ng435. For that, you’ll need to study JavaScript and DOM manipulation. Basically, you’ll need to do the following, inside a /<script</> tag:

  1. “get” something to click, say a button, const button = document.getElementById(“btn”)
  2. put an eventlistener on the button,
    button.addEventListener(“click”, changeImage).
  3. probably “get” the radio button element, const radio = document.form.myForm.value.
  4. write a function to change the image depending on the value, using, I think,

If you don’t know any JavaScript, it will take a bit of work to get there. Possibly it could all be done by googling the various steps I laid out. Otherwise, you might check out w3school’s tutorials on those separate elements. I’d also recommend the book “A Smarter Way to Learn JavaScript,” as you’ll learn most of that stuff in there, relatively painlessly.

Good luck!

1 Like