接收端:
if(window.postMessage){   if(window.attachEvent){     window.attachEvent('message',function(ev){       var message = ev.data;'#icon:100:50'       var messageArr=message.split(':');       if(messageArr[0]==='#icon'){         var style ={};         style.top=(Message[2])+'px';       }     });   }else if(window.addEventListener){
    window.addEventListener('message',function(ev){  
      var message = ev.data;'#icon:100:50'  
      var messageArr=message.split(':');
      if(messageArr[0]==='#icon'){
        var style ={};
        style.top=(Message[2])+'px';
      }     
    },false);
  }
}
发送端:
if(window.attachEvent){
  window.attachEvent("onmessage",function(){
    
  });
}
 $(window).scorll(function(e){
  if(window.postMessage && window.top){
    var message='icon'+(window.scrollX+"+"+window.scrollY);
    window.top.postMessage(message,'*');
  }
  });

  

12-22 15:25