2012年1月5日 星期四

彈跳視窗、關閉視窗

引入檔案:








場景:表格下每列的button

$editBox=





關鍵字:小視窗、跳出。

var newwin = null;
function opwin(news_id){
 newwin=window.open('thron/issue-news.php?id='+news_id,'nw','width=680px,height=580px,resizable=yes,scrollbars=yes,status=0');
  newwin.moveTo(200,10);
 }

  

 test  

關鍵字:小視窗關閉後刷主視窗頁面

子視窗:
<SCRIPT LANGUAGE="JavaScript">
function closeMeAndReloadParent() 

{  
 opener.location.reload();  
 window.close();  
}  
<SCRIPT">
<body onunload='closeMeAndReloadParent()'>



EX:點擊連結會使用window.open 另開無邊的視窗;在連結上右鍵又可以開啟分頁。

<a href='xxx.php?id={$data[$i]['msnauto']}' onClick="opwin({$data[$i]['msnauto']});return false;" >

function opwin(news_id){  
  newwin=window.open('xxx.php?id='+news_id,'nw','width=680px,height=680px,resizable=yes,scrollbars=yes,status=0');  
   newwin.moveTo(200,10);  
    }

關閉視窗
javascript:
  function doClose(){this.close();}

沒有留言: