Change value of HTML page variable with function

Change value of HTML page variable with function

Essentially I want to declare a variable in an html page then call a function that will change the value of that variable.

Is it possible?