Whenever you add masterpage, control ID's will change, you can view it via view source of your browser.
var textb = document.getElementById('TextBox1').value;
Above won't work when there is masterpage added. Do as sandeep mewara suggested, you can also do the following
var textb = document.getElementById('contentplaceholeID').value
paste the id of your control after viewing the source of your page.
Thanks