Taken from the HP 5400zl routing guide:
If no router ID is configured, then, by default, the router ID on a ProCurve
routing switch is the first IP address that becomes physically active at reboot.
This is usually the lowest numbered IP interface configured on the device.
However, if no router ID is configured and one or more user-configured
loopback interfaces are detected at reboot, then the lowest-numbered (user
configured) loopback interface becomes the router ID. If the lowest numbered
loopback interface has multiple IP addresses, then the lowest of
these addressees will be selected as the router ID. Once a router ID is selected,
it will not automatically change unless a higher-priority interface is configured.
The router id does not seem to be OSPF specific - but an ID that is specified at switch startup (after a reboot!). On Cisco I believe that the router id IS ospf specific, and is dynamically selected upon initialising or resetting the OSPF processes.
Hope this helps.
Pete.