Look at F:\sites\wp-git\wp-admin\js\common.js
:
$('div.updated, div.error').not('.below-h2, .inline').insertAfter( $('div.wrap h2:first') );
If your notice has the class updated
or error
, it will be set after the first h2
automatically. When you create custom messages, make sure you are using one of these classes. Then you can just append them to body
, and WordPress will move them to the proper place.