Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*==================================================================================================
- --------------------------------------------------------------------------------------------------
- [variable_var_names.js]
- How to declare (and manipulate) multiple variables, with variable names, as needed, with the
- added plus of indexing (and accessing) them in a way that standard arrays can't.
- (c) Damion 'Phr0z3n.dev' Tapper, 2014.
- Email: Phr0z3n.Dev@Gmail.com
- --------------------------------------------------------------------------------------------------
- ==================================================================================================*/
- /**
- * Consider this line one of the 'gems' of the code that makes 'all things' possible.
- **/
- var innerHTMLObject = new Object();
- function divClearRestore(prefix)
- {
- /**
- * From this point forward, the power of concactenation is going to make it possible to
- * (store and) manipulate an 'infinite' numbers of things with very limited coding.
- **/
- if(document.getElementById(prefix + "Button").innerHTML == "Clear")
- {
- document.getElementById(prefix + "Button").innerHTML = "Restore";
- /**
- * Consider this line the other 'gem'. Notice how variables are created with variable
- * (concactenated) names. Such a phenomenon is just not possible using the 'var' keyword.
- **/
- innerHTMLObject[prefix + "Div"] = document.getElementById(prefix + "Div").innerHTML;
- document.getElementById(prefix + "Div").innerHTML = "";
- }
- else
- {
- document.getElementById(prefix + "Button").innerHTML = "Clear";
- document.getElementById(prefix + "Div").innerHTML = innerHTMLObject[prefix + "Div"];
- /**
- * This line eventually frees the unneeded unused variable. Such and act adds to the
- * efficiency and, eventual security of your code.
- **/
- delete innerHTMLObject[prefix + "Div"];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement