
layui怎么对弹出层显示数据?下面给大家举个例子:
<a id="func11" onclick="func11();">点击查看</a>
function func11() {
console.log($.cookie("id"));
//iframe窗
layer.open({
type: 2,
title: false,
shade: [0.5],
title: '商品简介',
shadeClose: true,
shade: 0.5,
skin:'demo-class',
maxmin: true, //开启最大化最小化按钮
area: ['1000px', '660px'],
shift: 2,
content: 'product.jsp?id=<%=rs.getInt(“id”)%>', //iframe的url,
});
}错误:id号传不过去,页面跳转之后接收的id不正确,所以显示的页面不正确。
相关推荐:《layui框架教程》
错误原因:变量的作用域有问题。在上面的rs不能传到func11()方法里面,所以传递的参数有问题。
解决方法:在func11()函数中添加一个参数,将id这个参数在点击事件里添加进去。
修改后的代码:
<a id="func11" onclick="func11(<%=rs.getInt(“id”)%>);">点击查看</a>
function func11(x) {
$.cookie("id",x);
console.log($.cookie("id"))
//iframe窗
layer.open({
type: 2,
title: false,
shade: [0.5],
title: '商品简介',
shadeClose: true,
shade: 0.5,
skin:'demo-class',
maxmin: true, //开启最大化最小化按钮
area: ['1000px', '660px'],
shift: 2,
content: 'product.jsp?id=' + $.cookie("id"), //iframe的url
});
}以上就是layui怎么对弹出层显示数据的详细内容,更多请关注php中文网其它相关文章!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号