code: function getFrameId(){
          var frame = -1;
          if(isIframe){
              try{
                  var frameElement = window.frameElement;
                  if(frameElement !== null){
                      frame = getDomPath(frameElement) || -1;
                  }
                  else{
                      frame = '!'+location.href.replace(/^https?:/,'');
                      var parentFrames = parent.frames;
                      for(var i=0,len=parentFrames.length;i<len;i++){
                          if(parentFrames[i] === window){
                              frame = '!'+i;
                              break;
                          }
                      }
                  }
              }
              catch(e){}
          }
          else{
              frame = null;
          }
          return frame;
      }
docs: get frame id