Hi,
up to now it is not possible to use the JavaScript functions alert() and confirm() within TM's HTML output window.
But there is a solution (unfortunately this does not work for the HTML preview :( ).
The only thing I do is to write a kind of wrapper for these functions by using TextMate.system('"$DIALOG" -e ...').
<script type="text/javascript" charset="utf-8"> try { if (TextMate.system("", function (task) { })) { var __TM_confirm_Status; alert = function(s){TextMate.system('"$DIALOG" -e -p '{messageTitle="JavaScript";informativeText="'+s+'";}'',null);}; confirm = function(s){TextMate.system('"$DIALOG" -e -p '{messageTitle="JavaScript";informativeText="'+s +'";buttonTitles=("OK","Cancel");}'',null).onreadoutput=function(s) {if(s==1) {__TM_confirm_Status =false}else{__TM_confirm_Status=true}};return(__TM_confirm_Status)}; } } catch(e) {} </script>
The try block will be only executed if the code will be showed up in TM HTML output window.
If you put these lines into your HTML code the page will work within a normal browser as well as in TM's HTML output window.
Attached is a demo command. Simply press the buttons ;)
BTW With this approach I can prompt JavaScript errors by using simply "alert(err)" inside of TM ;)
--Hans