1Page.js
function TableRow() {
let cells = document.querySelectorAll('#recieve-info td');
cells.forEach(cell => cell.onclick = function () {
let prevcell = cell.previousElementSibling;
if (prevcell) {
let LSItems;
let AddValue = '/images/back_arrow.png.png'
if (localStorage.getItem('passvalue') === null) {
LSItems = [];
} else {
LSItems = JSON.parse(localStorage.getItem('passvalue'));
}
LSItems.push([AddValue]);
localStorage.setItem('passvalue', JSON.stringify(LSItems));
let prev = prevcell.innerHTML;
console.log(prev);
}
});
}
I am trying to pass values by onclick, like if i click on the first one which is 'Save1' i want to save my value only in the first one.
![This is my first page](https://i.stack.imgur.com/qm270.png)
2Page.js
function ParaG() {
document.querySelector('.Second-Para').innerHTML = JSON.parse(localStorage.getItem('passvalue'));
}
Here i want the values.
![This is second page output](https://i.stack.imgur.com/wtHwX.png)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…