Highlight cell border color when click, change back when click to others

后端 未结 1 849
说谎
说谎 2021-01-25 04:37

I have the code below:



        
1条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-25 04:46

        var redNow = 1;
        function highlight(cell) {
            redNow == 1 ? redNow = 0 : redNow.style.borderColor = "black";
            redNow = cell;
            cell.style.borderColor = "red";
        }
        td {
        		cursor: pointer;
        	}
       
    Cell 1 Cell 2 Cell 3
    Cell 4 Cell 5 Cell 6
    Cell 7 Cell 8 Cell 9

    0 讨论(0)
提交回复
热议问题