本文實例講述了JavaScript彈出新窗口后向父窗口輸出內容的方法。分享給大家供大家參考。具體如下:
下面的JS代碼演示了如何通過window.open方法打開一個彈出窗口,然后通過彈出窗口的句柄向父窗口輸出信息的方法
<!DOCTYPE html><html><head><script>function openWin(){myWindow=window.open('','','width=200,height=100');myWindow.document.write("<p>This is 'myWindow'</p>");myWindow.focus();myWindow.opener.document.write("<p>This is the source window!</p>");}</script></head><body><input type="button" value="Open 'myWindow'" onclick="openWin()" /></body></html>
希望本文所述對大家的javascript程序設計有所幫助。
新聞熱點
疑難解答