Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I am trying to figure out how to make a text box number reflect the number on the array i am trying to show. My code in attached. I am trying to make it that if i type "4" then 4 of my skills would pop up on my site.

    <script type="text/javascript">
function myduties1() {
var a= document.getElementById("DNumber1").value;
var duties1= ["Building Houses","Using Heavy Machinery","Lifting","Fixing","Working Fast"];
var b= a-1
var c=""
while (a>=b) {
c== "duties1[b]";
b++;
}

document.getElementById("mduties1").innerHTML =c;
}

</script>
<p><button onclick="myduties1()">Click Here</button>to see my top <input type="text"       id="DNumber1" value=""> job duties</p>
    <p id="mduties1"></p>
share

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.