<script type="text/javascript">
function bla()
{
if (typeof(myvar) == 'undefined')
{
myvar = "bla";
document.getElementById('bla').innerHTML = 'set';
}
else
{
delete myvar;
document.getElementById('bla').innerHTML = 'delete';
}
}
</script>
<div id="bla" onclick="bla();">click here</div>