https://www.cnblogs.com/dorothyorsusie/p/6178599.html
1 //iframe传参给父级页面 2 function give_info(){ 3 console.log("触发事件"); 4 window.parent.postMessage(1,‘*‘); 5 }
//接收值window.addEventListener(‘message‘,function(e){ var color=e.data; document.getElementById(‘color‘).style.backgroundColor=color; },false);
原文地址:https://www.cnblogs.com/wanan-01/p/10709690.html
时间: 2024-11-03 23:10:01