The InfoPath SDK comes with several complete forms with JavaScript as their underlying code. I know as I was developing my from that I referenced the "Invoice (multiple tax rates)" form to get some good direction. To access all of these examples simply open InfoPath, File -> Design a Form -> Customize a Sample... and choose a form that you think might be similiar to what you are trying to learn.
Also, the forms included with the SDK should be roundabouts here (with default install): C:\Program Files\Microsoft Office 2003 Developer Resources\Microsoft Office InfoPath 2003 SDK\Samples
---------------
Matt Faus
Matt Faus / Microsoft InfoPath MVPQdabra® Software / Streamline data gathering to turn process into knowledge