---
title: "jQuery Alert、Prompt、Confirm对话框"
author: "wangtong40"
date: "2010-06-01T22:49:02Z"
tags: ["JavaScript", "jQuery"]
categories: ["Web前端"]
slug: "jquery-alert-prompt-confirm"
draft: false
lastmod: "2010-06-01T22:49:02Z"
id: 681452
url: "https://wangtong40.iteye.com/blog/681452"
---

最近项目中频繁与jQuery打交道，仔细研究了一下这些插件的实现，似乎窥探出几分端倪出来，具体细节，还需要平日里多多积累，不断探索。

 

用户提出需要一个Prompt录入框，介于目前JavaScript的Prompt的功能确实单薄，我从jQuery诸多插件中发现了一款，简单，易用。

地址如下：  [http://www.sharejs.com/commdetails-582.aspx](http://www.sharejs.com/commdetails-582.aspx)

 

 

Alert对话框：

```
jAlert('This is a custom alert box', 'Alert Dialog');
```

 

 

 

 

Confirm对话框

```
jConfirm('Can you confirm this?', 'Confirmation Dialog', function(r) {
    jAlert('Confirmed: ' + r, 'Confirmation Results');
});
```

 

 

Prompt对话框：

```
jPrompt('Type something:', 'Prefilled value', 'Prompt Dialog', function(r) {
    if( r ) alert('You entered ' + r);
});
```