Thank you all for your remarks and ideas.
But....
I think (no: I know!) it is much simpler after all.
No need for extra js script, simply use: /includes/EditPage.php and make some modifications in $toolarray = array(:
For instance take:
array( 'image' => 'button_nowiki.png',
'id' => 'mw-editbutton-nowiki',
'open' => "<nowiki>",
'close' => "</nowiki>",
'sample'=> wfMsg('nowiki_sample'),
'tip' => wfMsg('nowiki_tip'),
'key' => 'N'
)
Copy and change it par example in a button for an intern anchorlink:
array( 'image' => 'intern.gif',
'id' => 'mw-editbutton-exlink',
'open' => "[[#",
'close' => "|to headline]]",
'sample'=> 'This Head',
'tip' => 'a link to \'This Head\' on the same page - remind the caption ',
'key' => ''
),
And you have a superior button!