Yii Framework 开发教程(38) Zii组件-ProgressBar示例
2014-01-20 12:47
429 查看
CJuiProgressBar显示一进度条。它封装了 JUI
Progressbar插件。CJuiProgressBar显示一进度条。它封装了 JUI
Progressbar插件。
[php]
view plaincopyprint?
<?php $this->widget('zii.widgets.jui.CJuiProgressBar', array(
'id'=>'progress',
'value'=>0,
'htmlOptions'=>array(
'style'=>'width:200px; height:20px; float:left;'
),
));
?>
[php]
view plaincopyprint?
<?php
// Dummy function just to provide an example
Yii::app()->clientScript->registerScript('scriptId', "
var count = 0;
var step = 10;
var speed = 500;
function progress() {
$('#amount').text(count+'%');
$('#progress').progressbar('option', 'value', count);
if(count < 100) {
count = count+step;
setTimeout(progress, speed);
}
}
progress();
", CClientScript::POS_LOAD);
?>
...
<div id="amount" style="margin-left:210px; padding:3px;"></div>
本例下载
更多
CJuiProgressBar显示一进度条。它封装了 JUI
Progressbar插件。CJuiProgressBar显示一进度条。它封装了 JUI
Progressbar插件。
[php]
view plaincopyprint?
<?php $this->widget('zii.widgets.jui.CJuiProgressBar', array(
'id'=>'progress',
'value'=>0,
'htmlOptions'=>array(
'style'=>'width:200px; height:20px; float:left;'
),
));
?>
<?php $this->widget('zii.widgets.jui.CJuiProgressBar', array( 'id'=>'progress', 'value'=>0, 'htmlOptions'=>array( 'style'=>'width:200px; height:20px; float:left;' ), )); ?>为了演示进度条,我们使用JavaScripts改变进度条当前值,并使用一个文本显示当前进度条的值。
[php]
view plaincopyprint?
<?php
// Dummy function just to provide an example
Yii::app()->clientScript->registerScript('scriptId', "
var count = 0;
var step = 10;
var speed = 500;
function progress() {
$('#amount').text(count+'%');
$('#progress').progressbar('option', 'value', count);
if(count < 100) {
count = count+step;
setTimeout(progress, speed);
}
}
progress();
", CClientScript::POS_LOAD);
?>
...
<div id="amount" style="margin-left:210px; padding:3px;"></div>
<?php // Dummy function just to provide an example Yii::app()->clientScript->registerScript('scriptId', " var count = 0; var step = 10; var speed = 500; function progress() { $('#amount').text(count+'%'); $('#progress').progressbar('option', 'value', count); if(count < 100) { count = count+step; setTimeout(progress, speed); } } progress(); ", CClientScript::POS_LOAD); ?> ... <div id="amount" style="margin-left:210px; padding:3px;"></div>
本例下载
更多
相关文章推荐
- Yii Framework 开发教程(38) Zii组件-ProgressBar示例
- Yii Framework 开发教程(44) Zii组件-Resizable示例
- Yii Framework 开发教程(34) Zii组件-AutoComplete示例
- Yii Framework 开发教程(39) Zii组件-Slider示例
- Yii Framework 开发教程(22) UI 组件 Zii组件简介
- Yii Framework 开发教程(35) Zii组件-Button示例
- Yii Framework 开发教程(40) Zii组件-SliderInput示例
- Yii Framework 开发教程(42) Zii组件-Draggable示例
- Yii Framework 开发教程(36) Zii组件-DatePicker示例
- Yii Framework 开发教程(37) Zii组件-Dialog示例
- Yii Framework 开发教程(37) Zii组件-Dialog示例
- Yii Framework 开发教程(41) Zii组件-Tabs示例
- Yii Framework 开发教程(46) Zii组件-Sortable示例
- Yii Framework 开发教程(29) Zii组件-Menu 示例
- Yii Framework 开发教程(43) Zii组件-Droppable示例
- Yii Framework 开发教程(39) Zii组件-Slider示例
- Yii Framework 开发教程(45) Zii组件-Selectable示例
- Yii Framework 开发教程(40) Zii组件-SliderInput示例
- Yii Framework 开发教程(29) Zii组件-Menu 示例
- Yii Framework 开发教程(41) Zii组件-Tabs示例