What is the syntax of including a variable in document.write statement?
Posted on 2011-09-20
I have several localStorage variables set. There names and values are as follows:
localStorage.trxCtr = 2
localStorage.item1 = 1000
localStorage.item2 = 2000
Below is the code that I am currently trying to use. I want to loop for the value of my counter and create an <li> with the corresponding localStorage item.
var i =1;
document.write("<li><a href=getitemdetail.php?item="localStorage["item" + i ]">something here</a></li>");
I need the syntax to set the value of item in my <a href> statement.