JavaScript Javascript: Using Buttons to navigate a table javascript using buttons,javascript using radio buttons,javascript calculator using

I'm having trouble figuring this out. I've created a table, and I want to use clickable buttons (not the arrow keys) to navigate through each cell and mark that cell as yellow. The table builds and I can navigate down, but not up. Is there an easier way to traverse the table with the clickable buttons. I have spent way too much time figuring this out to really care to admit.

edit: We're supposed to be using and navigating through the DOM to the elements.

edit 2: Fixed the issue of cell's not marking. And the buttons correctly traverse both down and up, but the UP goes into the header row which I do not wan. Still can't figure out going right/left. I updated the pastebin link.

edit 3: I seem to have gotten it working now. Adding JSfiddle link: http://jsfiddle.net/rq3tjpu1/

 function buildTable() {

var newTable = document.createElement("table");


//Var I = Rows
//Var J = columns
for (var i = 0; i < 4; i++) {
    var tr = document.createElement('tr');

    for (var j = 0; j < 4; j++) {
        var td = document.createElement('td');

        if (i == 0 && j != 4){
            td.appendChild(document.createTextNode("Header "))
            td.appendChild(document.createTextNode((j+1)))
            tr.appendChild(td)

        }

        else {
            td.appendChild(document.createTextNode(i))
            td.appendChild(document.createTextNode(", "))
            td.appendChild(document.createTextNode((j+1)))
            tr.appendChild(td)
        }


    }

   newTable.appendChild(tr);
}

document.getElementById("tableHere").appendChild(newTable);
newTable.setAttribute("border", 3);
newTable.style.width = '50%';
return newTable;
}
Answer:1

Why not assign a specific value ( could be in the form of attributes) for the position of each cell? So each cell would have an X and Y value . Then you would keep a variable storing the current X and Y values. Once an arrow key has been pressed, you can use jQuery to select the cell with the required X and Y values, so for Up button that would be: (X, Y+1) , Down button (X, Y-1), Left (X-1, Y), Right (X+1, Y).

In this case it would be a good idea to use verification on the min/max X and Y values.

Hope this helps.

Answer:2

Currently I've got the following JSON feed: var data = { "feeds": { "regions": [{ "name": "Lichtenberg", "id": "01408.b", "suburbs": [{ "name": "Fennpfuhl", ...

Currently I've got the following JSON feed: var data = { "feeds": { "regions": [{ "name": "Lichtenberg", "id": "01408.b", "suburbs": [{ "name": "Fennpfuhl", ...

  1. creating array with for loop python
  2. creating array with values java
  3. creating array with numpy
  4. creating array with malloc
  5. creating array with new c++
  6. creating array with new
  7. creating array with negative size
  8. creating array with python
  9. creating array with
  10. creating array with integers java
  11. creating array with string
  12. creating array with mdadm
  13. creating array in java
  14. creating array in javascript
  15. creating array in php
  16. creating array in c
  17. creating array in matlab
  18. creating array in r
  19. creating array in js
  20. creating array in typescript

I need a textarea to include a set of double quotes at the start and end of the textarea value. The below code works in that double quotes are added to the start and end of the field, but if the user ...

I need a textarea to include a set of double quotes at the start and end of the textarea value. The below code works in that double quotes are added to the start and end of the field, but if the user ...

I have an URL looking like this: https://www.website.com/dk/da/home/category/ I am trying to remove the last forward slash and the text before it, untill it reaches the new forwardslash. Meaning i ...

I have an URL looking like this: https://www.website.com/dk/da/home/category/ I am trying to remove the last forward slash and the text before it, untill it reaches the new forwardslash. Meaning i ...

  1. remove last forward slash javascript
  2. remove last forward slash c#
  3. php remove last forward slash
  4. bash remove last forward slash from string
  5. regex replace last forward slash

I have a function to call API from the server like this: getDataSet(callback) { request.open('POST', `${apiPath}`); request.setRequestHeader('Content-Type', 'application/x-...

I have a function to call API from the server like this: getDataSet(callback) { request.open('POST', `${apiPath}`); request.setRequestHeader('Content-Type', 'application/x-...

  1. json data response example
  2. json data response
  3. json data response ajax
  4. json data response jquery
  5. json response data format
  6. json response data type
  7. json response data count
  8. json response data undefined
  9. json response data python
  10. json response data model
  11. get json data response
  12. sample json data response
  13. send json data response
  14. json binary data response
  15. jbuilder json_data_response
  16. c# json data response
  17. access json response data
  18. axios json response data
  19. json.parse(response.data)
  20. laravel json response data