A number of issues with your code I'll try to list them out hopefully it solves your problem.
1. The onClick function on your button is set to pass 'tails' argument to your function all(). Try replacing 'all' in your first 'if' statement with 'value'.