print ("<Script language=\"JavaScript\">
if (window.confirm('do you want to run the script?') ) {");
script to run if yes
print("}
</Script>");
return;
<?php //... stuff here $msg = 'Some string...'; $modx->event->alert($msg); //... more stuff here ?>