|
Sunday, 04 November 2007 |
|

这个插件能够在你你行动时给出确认信息。
原文:http://nadiaspot.com/jquery/confirm/
本文版权属于原作者。
未经本站允许不得转载!
文档:
(element).confirm(options) %28element%29.confirm%28options%29%20
| options |
| Name |
Type |
Optional |
Description |
Default Value |
| msg |
String |
Optional |
Confirmation message |
'Are you sure?' |
| stopAfter |
string |
Optional |
Determines when the confirmation dialog will stop being promoted.
Possible values ('never', 'ok', 'cancel', 'once') |
'never' |
| wrapper |
String |
Optional |
Dialog wrapper |
'<span></span>' |
| eventType |
String |
Optional |
The event that triggers the confirmation |
'click' |
| dialogShow |
String |
Optional |
Dialog displaying effect |
'show' |
| dialogSpeed |
String |
Optional |
Dialog displaying speed |
'fast' |
| timeout |
Integer |
Optional |
Time in milliseconds to hide the confirmation dialog |
0 |
| options.buttons |
| ok |
String |
Optional |
Ok caption |
'Yes' |
| cancel |
String |
Optional |
Cancel caption |
'No' |
| wrapper |
String |
Optional |
Button wrapper |
'<a href="#"></a>' |
| separator |
String |
Optional |
Separator between buttons |
'/' |
| cls |
String |
Optional |
Button class |
undefined |
例1:
<p>// The action.
$('a').click(function() {
alert('click');
return false;
})</p>
<p>// The most simple use.
$('a').confirm();</p>%0D%0A%3Cp%3E%2F%2F%20The%20action.%0A%0D%0A%20%24%28%27a%27%29.click%28function%28%29%20%7B%0A%0D%0Aalert%28%27click%27%29%3B%0A%0D%0Areturn%20false%3B%0A%0D%0A%7D%29%3C%2Fp%3E%0D%0A%3Cp%3E%2F%2F%20The%20most%20simple%20use.%0A%0D%0A%20%24%28%27a%27%29.confirm%28%29%3B%3C%2Fp%3E
预览1:
例2:
<p>// The action.
$('input[type=button]').click(function() {
$(this).remove();
});</p>
<p>$('input[type=button]').confirm({
msg:'Do you really want to delete this button?',
timeout:3000
});</p>
%0D%0A%3Cp%3E%2F%2F%20The%20action.%0A%0D%0A%20%24%28%27input%5Btype%3Dbutton%5D%27%29.click%28function%28%29%20%7B%0A%0D%0A%24%28this%29.remove%28%29%3B%0A%0D%0A%7D%29%3B%3C%2Fp%3E%0D%0A%3Cp%3E%24%28%27input%5Btype%3Dbutton%5D%27%29.confirm%28%7B%0A%0D%0A%20msg%3A%27Do%20you%20really%20want%20to%20delete%20this%20button%3F%27%2C%0A%0D%0A%20timeout%3A3000%0A%0D%0A%20%7D%29%3B%3C%2Fp%3E%0D%0A
预览2:
例3:
<p>// The action.
$('span').mouseover(function() {
$(this).html('Here is the offer');
});</p>
<p>$('span').confirm({
msg:'See my interesting offer?',
stopAfter:'ok',
eventType:'mouseover',
timeout:3000,
buttons: {
ok:'Sure',
cancel:'No thanks',
separator:' '
}
});</p>%0D%0A%3Cp%3E%2F%2F%20The%20action.%0A%0D%0A%20%24%28%27span%27%29.mouseover%28function%28%29%20%7B%0A%0D%0A%24%28this%29.html%28%27Here%20is%20the%20offer%27%29%3B%0A%0D%0A%7D%29%3B%3C%2Fp%3E%0D%0A%3Cp%3E%24%28%27span%27%29.confirm%28%7B%0A%0D%0A%20msg%3A%27See%20my%20interesting%20offer%3F%27%2C%0A%0D%0A%20stopAfter%3A%27ok%27%2C%0A%0D%0A%20eventType%3A%27mouseover%27%2C%0A%0D%0A%20timeout%3A3000%2C%0A%0D%0A%20buttons%3A%20%7B%0A%0D%0A%20ok%3A%27Sure%27%2C%0A%0D%0A%20cancel%3A%27No%20thanks%27%2C%0A%0D%0A%20separator%3A%27%20%20%27%0A%0D%0A%20%7D%0A%0D%0A%20%7D%29%3B%3C%2Fp%3E
预览3:
例4:
<p>$('a').confirm({
timeout:3000,
dialogShow:'fadeIn',
dialogSpeed:'slow',
buttons: {
wrapper:'<button></button>',
separator:' '
}
});</p>%0D%0A%3Cp%3E%24%28%27a%27%29.confirm%28%7B%0A%0D%0Atimeout%3A3000%2C%0A%0D%0AdialogShow%3A%27fadeIn%27%2C%0A%0D%0AdialogSpeed%3A%27slow%27%2C%0A%0D%0Abuttons%3A%20%7B%0A%0D%0Awrapper%3A%27%3Cbutton%3E%3C%2Fbutton%3E%27%2C%0A%0D%0Aseparator%3A%27%20%20%27%0A%0D%0A%7D%20%0A%0D%0A%7D%29%3B%3C%2Fp%3E
预览4:
源文件下载:http://www.hotajax.org/download/jquery/jQuery Confirm Plugin.zip
|