Home  >  Article  >  php教程  >  Yii中registerScript的语法注意事项

Yii中registerScript的语法注意事项

WBOY
WBOYOriginal
2016-06-13 10:56:551122browse

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');

");

?>


 

Statement:
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
Previous article:中文分词处理方法Next article:PHP中array数组教程