<head></head>
<body>
<!-- dialog -->
<button onclick=dakai()></button>
<dialog id='dialog'>this is a dialog</dialog>
<script>
var dakai=function(){
var x=document.getElementById("dialog").open
console.log(x)
if(x){
document.getElementById("dialog").removeAttribute('open')
}else{
document.getElementById("dialog").setAttribute('open','open')
}
</script>
</body>
</html>
使用window.returnvalue在父级页面打开子集页面,可以获取子集的返回值。在子集中给window.returnvalue赋值,将在父级中获得这个值。
父级中这样写:
var returnVal=window.ShowModeDialog(xxxxx)
子集中这样写:
window.returnvalue=input框的值。
父级中的returnVal变量就是你要的值了。
除了这个,还可以使用cookie、sessionstrog等来存储,不过window.returnvalue是最简便也是最适合你的。