给父窗口添加新的代码

var  popSrc = " < " + " div id='v_popImg' name='v_popImg' style='position:absolute;top:300px;left:200px;width:456px;height:95px;z-index: 999;visibility:visible'> " ;
popSrc
+= " < " + " table width='100%' height='100%' border='0' background='/images/bk.jpg'> " ;
popSrc
+= " < " + " tr height='10'> " ;
popSrc
+= " < " + " td colspan='2'>&nbsp;</td> " ;
popSrc
+= " </tr> " ;
popSrc
+= " < " + " tr height='24'> " ;
popSrc
+= " < " + " td colspan='2' align=center id=mytitle name=mytitle></td> " ;
popSrc
+= " </tr> " ;
popSrc
+= " < " + " tr align='center'> " ;
popSrc
+= " < " + " td>< " + " a id=v_popA name=v_popA href=javascript:OK() onmouseover=\ " window.status = ''; return   true ;\ " >< " + " img src='/images/yes.jpg' border=0></a></td> " ;
popSrc
+= " < " + " td>< " + " a id=v_popR name=v_popR href='javascript:NO();' onmouseover=\ " window.status = ''; return   true ;\ " >< " + " img src='/images/no.jpg' border=0> " + " < " + " /a> " + " < " + " /td> " ;
popSrc
+= " < " + " /tr> " ;
popSrc
+= " < " + " /table></div> " ;
var  parentText = parent.document.body.innerHTML;
if  (parentText.indexOf('v_popImg') ==- 1 )
{
    parent.document.body.innerHTML
=parentText+popSrc;
}

最后的判断一下父窗口是否已经有代码了.不然就会变成死循环的样子了.它会一直加载我们给的代码

你可能感兴趣的:(代码)