Home > php教程 > php手册 > body text

Yii中registerScript的语法注意事项

WBOY
Release: 2016-06-13 10:56:55
Original
1122 people have browsed it

autoLoad 名字不能和别的Script重复!
不要用 注释,如 //
嵌入PHP 变量 :'".$params['sdate']."'
  HTML 里面 的 Value 要用 双引号,而且要转意!!!!

 


Yii::app()->clientScript->registerScript('autoLoad', "
var status= '".$params['type']."';
var sdate = '".$params['sdate']."';
var edate = '".$params['edate']."';
var word = '".Yii::app()->request->getParam('word')."';
$('#ShopInfo_shop_products').val(word);
if(status == 'osub') {
    $('#shop_launch_start_time').val(sdate);
    $('#shop_launch_end_time').val(edate);
    $.fn.yiiGridView.update('report-grids', {
        data: $('#form').serialize()
    });
}

var currentUser = '".Yii::app()->user->getName()."';
if(currentUser== 'admin')
$('').insertAfter('#ShopInfo_shop_area_id option:last');

");

?>


 

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!