I would like to display one of arrays after clicking matching array: for example
var DetailArray = new Array(
"number 1",
"number 2",
"number 3"
);
function ShowNumber(number) {
document.getElementById("number").value= ;
}
img src image 1 calling function: ShowNumber();
and paragraph when it would be displayed
<p id="number"></p>
but I don't really know how to make a loop which will take from arrays matching string.
Use textContent
or innerHTML
to set the contents of a paragraph or DIV, value
is for the value of user inputs.
function ShowNumber(number) {
document.getElementById("number").textContent = DetailArray[number];
}
Image 1 can then contain:
onclick="ShowNumber(0)"
to show number 1
.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments