In general (unmodified desktop browsers only), I guess not (see other answers). However, if you were looking at other applications of JavaScript alerts, this may be possible. For instance, with the Android SDK, you would use the onJsAlert method from WebChromeClient:
public boolean onJsAlert(WebView view, String url, String message,
final android.webkit.JsResult result) {
builder.setTitle(ActivityTitle)
.setMessage(message)
.setPositiveButton("OK",
new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
result.confirm();
}
}).setCancelable(false).create().show();
return true;
}
It may be worthwhile to inspect the source code to see how this is accomplished. This may have hooks into the browser, but if you really want to get into it, this may be interesting.
Alternatively
If you need to be able to have a sort of alert-style box which can be controlled using JavaScript, then it should also conform to ARIA specifications, as mentioned in the MDN on the alert role. Doing this would allow similar functionality, allow the alert to be styled, and would also be usable by people with accessibility devices.
One down side I can see to using this is that it wouldn't hook into something like what's talked about above. If an Android developer has chosen to override the alerts, then I don't think it would work as expected.
prompt()?promptprogrammatically.