the following gives me an error in IE6.0 and 5.5, but not in IE5.0

I have statements like
document.frm.realname.value
where frm is my form's name and the error is:
LINE:62
ERROR: 'document.frm.realname' IS NULL OR NOT AN OBJECT.

so what's the correct way to refer to my form fields for those browsers?