Archie2033 Archie2033 - 1 year ago 73
HTML Question

What's wrong with this code(Java script, buttons, html)?

<!DOCTYPE html>


<title>Question 2</title>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>


<button onClick="myFunction()">Alphabetical order</button>

<button onClick="countFunction">Count</button>

<p id="i"></p>

<p id="ii"></p>


var products = ["Printer", "Tablet", "Router", "Keyboard"];

document.getElementById("i").innerHTML = products;

function myFunction() {


document.getElementById("i").innerHTML = products;

function countFunction() {
document.getElementById("i").innerHTML = products.length;





please help, I think it's just a spelling or formatting error. If you can change the code as little as possible while still fixing it I would appreciate it a lot.If you need any more details just ask. I would be happy to provide as much information as I can to help you help me.

This is for my son he loves traffic lights!/s

Answer Source

Modify these lines:

<button onClick="myFunction();">Alphabetical order</button>

<button onClick="countFunction();">Count</button>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download