var 变量名 = parent.document.getElementsByTagName("标签"); alert(变量名[x].id); 说明: x 为该标签在你的html中的位置。比如span标签是你html的第一个span,那么x=0