You're talking about two separate things:
- A custom calculation script for a text field that makes it dependent on a check-box
- Showing/hiding text in the file based on the value of a check-box
The code above seems for the former issue. Are you getting any error messages in the JS Console? What exactly is not working correctly?
As for the latter issue, is this text located inside of a text field? Or is it static text in the document?