javascript - javascript - 意外的令牌?
问题描述
我想在上传照片时添加加载 gif。这是我的 JavaScript:
<script type="text/javascript">
function call(tab) {
$(".loading").html("<center><br><br><img src=\"icons/processing.gif\" /><br><br></center>").load(tab);
}
</script>
这就是我调用函数的方式:
<div class="loading"></div>
<div class="col-md-12">
<div class="form-group">
<input type="file" name="take_photo" id="take_photo" class="take-photo" onchange="submit(); call('survey_edit.php?id='<?$id;?>'&step=photo')">
<label for="take_photo"><figure><img src="icons/camera.png"></figure> <span><?=v("take_photo");?>…</span></label>
</div>
<div class="form-group">
<?=$f->input("back",v("back"),"type='button' onclick=\"window.location='?step=2&id=".$id."';\"","btn btn-warning");?>
<?=$f->input("finish",v("finish"),"type='button' onclick=\"window.location='mysurvey.php';\" style='position:relative;float:right;'","btn btn-primary");?>
</div>
</div>
它显示以下错误:“Uncaught SyntaxError: Unexpected token ?”
谁能帮我这个?
解决方案
您的 onchange 事件应如下所示:
onchange="submit(); call('survey_edit.php?id=<?=$id?>&step=photo')"
推荐阅读
- javascript - 用 css 覆盖 img - 来自不同设备的可视化问题
- python - 如何在嵌套 for 循环下对我的嵌套 if 语句进行矢量化(使用 Numpy/Pandas)
- spring-boot - SpringBoot,测试容器以测试发送到外部数据库的查询
- sparql - 嵌套 SPARQL 查询
- c# - 通过 PowerShell 管理 .Net 可执行文件的引用
- php - 为什么用户输入不附加到我的 SQL 数据库?
- websocket - 如何在 JMeter 的 While 控制器中过滤掉最后一个采样器?
- javascript - 回调函数未定义,即使它在调用 javascript 之前已被定义
- android - 验证 org.WebRTC VideoFrame 或 NV21Buffer 是否包含有效(未损坏)图片
- android - Android RecyclerView 显示项目的最佳实践