我有(xupload)blueimp插件的这个模板:
<script id="template-upload" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-upload fade">
<td class="preview"><span class="fade"></span></td>
<td class="title"><label>Title: <input type="text" name="title" required></label></td>
<td class="name"><span>{%=file.name%}</span></td>
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
{% if (file.error) { %}
<td class="error" colspan="2"><span class="label label-important">Error</span> {%=file.error%}</td>
{% } else if (o.files.valid && !i) { %}
<td>
<div class="progress progress-success progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="bar" style="width:0%;"></div></div>
</td>
<td class="start">{% if (!o.options.autoUpload) { %}
<button class="btn btn-primary">
<i class="icon-upload icon-white"></i>
<span>Start</span>
</button>
{% } %}</td>
{% } else { %}
<td colspan="2"></td>
{% } %}
<td class="cancel">{% if (!i) { %}
<button class="btn btn-warning">
<i class="icon-ban-circle icon-white"></i>
<span>Cancel</span>
</button>
{% } %}</td>
</tr>
{% } %}
</script>
我正在尝试运行这个javascript代码,它不起作用,但是当我在控制台中运行它以使其工作时,在页面加载完成时运行它的方法是什么
<script type="text/javascript">
jQuery(document).ready(function(){
$("input[type=text]").focus(function(){
alert('some text');
});
});
</script>
就我而言, 我正在使用yii扩展名(select2)这个扩展名生成javascript select:
<script id="template-upload" type="text/x-jQuery-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr class="template-upload fade">
<td class="preview">
<span class="fade"></span>
</td>
{% if (file.error) { %}
<td class="error" colspan="2"><span class="label label-important">Error</span> {%=file.error%}</td>
{% } else if (o.files.valid && !i) { %}
<td>
<label><?php echo CHtml::label('Keywords', 'keywords'); ?></label>
<?php
echo CHtml::textField('tags',$selected,array('id'=>'tags'));
$this->widget('ext.select2.ESelect2',array(
'selector'=>'#tags',
'options'=>array(
'tags'=>$tags,
'width'=>'400px;',
),
));
?>
</td>
<td>
<div class="progress progress-success progress-striped active"><div class="bar" style="width:0%;"></div></div>
</td>
<td class="start">{% if (!o.options.autoUpload) { %}
<button class="btn btn-primary">
<i class="icon-upload icon-white"></i>
<span>Start</span>
</button>
{% } %}</td>
{% } else { %}
<td colspan="2"></td>
{% } %}
<td class="cancel">{% if (!i) { %}
<button class="btn btn-warning">
<i class="icon-ban-circle icon-white"></i>
<span>Cancel</span>
</button>
{% } %}</td>
</tr>
{% } %}
</script>
答案 0 :(得分:0)
对不起,有一个高等级的asynchounus问题。
的 MVC 强> 的 有两个MVC封装(什么是好的),
第一个MVC没问题,第二个是不好的做法。
通常,您将通过从辅助模板中分离Primary-PHP来获得成功,因此您必须将主控制器,主视图,辅助模型,辅助控制器的信息引导至辅助视图!
我知道这是很多工作,但唯一的方法是清理。