You cannot view the html code within Publisher itself. But then Publisher
doesn't even write the code until it generates the html files during the
save as web process.
You can open the html files in Notepad or any html editor.
Note than any manual modification to said files will be lost next time
Publisher does a save as web.
As far as inserting scripts or any coding into Publisher with the html code
fragment dialog, all said code inserts go into the body tag of the page.
There is no access to the head tag or otherwise outside the body tag.
Note that I personally have tested numerous scripts with Publisher fragments
over the years and each one ran successfully. Even those that specify
placement in the head section. I found no issues running scripts in the body
section (where Publisher writes them).
I recommend placing such code inserts at the very bottom of the publisher
page. Unless the script creates a display that requires a specific placement
on the page layout.