您好,我正在嘗試為預算跟蹤應用程序構建一個包含輸入的表格。我在 JS 上遇到了一些麻煩。本質上,我希望用戶能夠添加、編輯和保存行。我只希望保存或編輯按鈕一次可見。這在編輯并保存一行后有效,但默認情況下它會顯示所有按鈕。同樣,在編輯一行之后,按鈕不再排成一行,而是堆疊在彼此之上。任何幫助將非常感激。這是我第一次使用 JS。我的代碼<div> <!-- ... --> <div class="five"> <h1>Transactions</h1> <div class="txlist"> <table cellspacing="0" cellpadding="0" border="0" width="1500"> <thead> <th>Date</th> <th>Account</th> <th>Category</th> <th>Amount</th> <th></th> </thead> <tbody class="txlist" id="data_table"> <tr id="addtx"> <td><input type="date" id="new_date" placeholder="Date"></td> <td><input type="text" id="new_account" placeholder="Account"></td> <td><input type="text" id="new_category" placeholder="Category"></td> <td><input type="text" id="new_amount" placeholder="Amount"></td> <td> <input type="button" id="save_button3" value="Save" class="save" onclick="add_row();"> <input type="button" value="??" class="delete" onclick="nonew()"> </td> </tr> <tr id="row1"> <td id="date_row1">24.08.2020</td> <td id="account_row1">Credit Card</td> <td id="category_row1">Expense: Restaurants</td> <td id="amount_row1">- $32.45</td> <td> <input type="button" id="edit_button1" value="Edit" class="edt" onclick="edit_row('1')"> <input type="button" id="save_button1" value="Save" class="save" onclick="save_row('1')"> <input type="button" value="??" class="delete" onclick="delete_row('1')"> </td> </tr>
表格行的編輯/保存按鈕的可見性問題 (JS)
青春有我
2023-04-01 15:16:42