html1:
<button class="layui-btn" onclick="javascript:window.open('objResultList.html?refCaseNo='+ document.getElementById('caseNo').value)"> <i class="fa fa-save"></i>详情</button>
html2:
<script type="text/javascript">
var str=window.location .href;//取地址参数部分
var refCaseNo = str.substr(str.indexOf('=')+1);
alert("bb:"+str);//传递过去的是:http://localhost:8080/pages/3yysj/objResultList.html?refCaseNo=CourtDetail_14127_20190329170345
alert("cc:"+refCaseNo);//CourtDetail_14127_20190329170345
</script>
本文展示了一个HTML按钮与JavaScript代码交互的实例,通过点击按钮,可以打开一个新的页面并传递参数。实例中详细展示了如何使用JavaScript获取URL参数,并在新页面中显示。
1705

被折叠的 条评论
为什么被折叠?



