getElementById do not work in IE 9

I have Javascript code in a form in pass-Thru HTML as follows:Add

It is not working in IE 9 it gives the following error:

Error: Unable to set value of the property ‘value’: object is null or undefined

when I check Tools compatablity view it works. How do I fix, any sugestions would be appreciated.

Subject: IE9 issues

There are loads of problems with IE9 and getElementById

Doing a google search gives half a hundred problems and fixes, depending upon where the code is used

A fairly consistent ‘fix’ seems to be to put the getElementById code intoa function and call that instead