Keep in mind the ASP.NET will mangle the control's ID, especially when in containers such as content placeholders used for Masterpages. Look at the actual rendered output and you will see this control is actually something like ctrl001_name_box.
You would be better off, IMO, using Jquery and doing something like this
var name_box = $("[id$='name_box']");
This will find the element whose id attribute ends with name_box, regardless of how many prefixes ASP.NET adds.