PDA

View Full Version : Javascript: I need help with variables, please :-)



nikonian
February 13th, 2012, 01:51 AM
Hi there. I cannot find a way to put:



document.getElementById("HiddenDiv").style.display = 'block';
into:


var someVariableNameHere
... and call the var name, instead of the code in the first code block. I know it is possible, just not how to do so.

Thank you, even if you cannot help me :)

ofnuts
February 13th, 2012, 11:29 AM
Hi there. I cannot find a way to put:



document.getElementById("HiddenDiv").style.display = 'block';
into:


var someVariableNameHere
... and call the var name, instead of the code in the first code block. I know it is possible, just not how to do so.

Thank you, even if you cannot help me :)

To declare:

var myfunc=function () {document.write("Hello world!");};
To use:

myfunc()

nikonian
February 13th, 2012, 03:09 PM
You are very kind, thank you.

God bless you man.