# Javascript problem when running function?

**URL:** <https://forum.kirupa.com/t/javascript-problem-when-running-function/326143>\
**Category:** web dev\
**Created:** [November 25, 2011, 4:27am UTC](https://forum.kirupa.com/t/javascript-problem-when-running-function/326143 "2011-11-25T04:27:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesstella](https://avatars.discourse-cdn.com/v4/letter/j/7c8e57/32.png) [@jamesstella](https://forum.kirupa.com/u/jamesstella)\
**Post date:** [November 25, 2011, 4:27am UTC](https://forum.kirupa.com/t/javascript-problem-when-running-function/326143/1 "2011-11-25T04:27:55Z")

</div>

Here is my function:

\<script type=“text/javascript”\>  
\<!–  
var unlockproperty = 1

function addigit() { unlockproperty=unlockproperty+1; }

if (unlockproperty \> 1) {window.open

(“[http://www.yahoo.com](http://www.yahoo.com)”)}  
//–\>\</script\>

and here is my input button that calls the function:

\<input type=“button”  
value =“add digit”  
onclick=“addigit()”\>\</button\>

Here is the problem. When I click my “add digit” button, the function adds the digit to my “unlockproperty()” variable, however when “unlockproperty()” becomes greater than 1, nothing happens, even though it is supposed to open up to [yahoo.com](http://yahoo.com).
