原始代码:
// 页面
<a class="aStyBig" href="javascript:alertInfo();">一键缴费</a>
// JS
<script src="${ctx}/js/layer/layer.js" type="text/javascript" />
<script type="text/javascript">
function alertInfo() {
layer.open({
content: '一键缴费、查询详情请下载APP',
btn: ['下载APP', '取消'],
shadeClose: false,
yes: function(){
location.href = "https://***********";
}
});
}
$(".sureInfo").click(function() {
alertInfo();
});
$(".addUall").click(function() {
location.href = "${ctx}/***********";
});
</script>
这段代码是这样写的. 一直都在提示说function未定义, 但很明显function是定义了的. 问题其实很简单, 就是出在了<script src="${ctx}/js/layer/layer.js" type="text/javascript" />
我也不知道为什么, 但是我写成 <script src="${ctx}/js/layer/layer.js" type="text/javascript" ></script>
就可以了.