September 22, 200917 yr Hi! To begin with explaining my problem, I'l just show you some code: function moveLeft(id) { e = document.getElementById(id).style.right; if (e.runOnce || 1) { e.variable1=1; e.variable2=1; e.variable3=1; e.runOnce=1; } (some code that requires the saved variables next time this function is run) } As you see, I saved some variables inside an element in this code. This is useful sometimes, but can I save variables in a similar way, in other things than HTML elements? Like, creating an object in Javascript or something. It's not allways wery handy to create a new HTML element each time I want a place to save variables. PS: I am pretty new to HTML and Javascript, so please excuse me if I've got some words or names wrong here
Create an account or sign in to comment