固定視窗的大小(四)
範例

Click to View Picture     Click to View Picture

使用 JavaScript 程式後,可指定彈出視窗大小。
開啟方式:網頁 + 內容,設有關閉視窗功能。
使用 JavaScript 程式如下:
<script language="JavaScript" type="text/javascript">
<!--- Hide script from old browsers
	function OpenNewWindow(cPicture,nWidth,nHeight,nBorder)
	{
	NewWindow=window.open("","NeuEins","HEIGHT="+nHeight+",WIDTH="+nWidth+",scrollbars=no,resizable=no,top=5,left=5");
	NewWindow.document.write ("<HTML><HEAD><TITLE>");
	NewWindow.document.write ("</TITLE></HEAD>");
	NewWindow.document.write ("<BODY BGCOLOR='black'>");	
	NewWindow.document.write ("<P ALIGN=CENTER>");
	NewWindow.document.write ("<FONT FACE='Arial' SIZE='+2' COLOR='White'><B>");
	
	NewWindow.document.write ("</B></FONT>");
	NewWindow.document.write ("<IMG SRC=");
	NewWindow.document.write (cPicture);
	NewWindow.document.write (">");
	NewWindow.document.write ("</P>");
	NewWindow.document.write ("<center><FORM><INPUT TYPE='button' VALUE='Colsed' onClick='self.close()'>");
	NewWindow.document.write ("</FORM></CENTER></BODY></HTML>");
	NewWindow.document.write ("</BODY></HTML>");
	NewWindow.document.close();
	return false;
	}
	// end hiding from old browsers -->
</script>

<BODY>

<a href=# onClick="OpenNewWindow('pics/pic01.jpg',640,520);return false;">Click to View Picture</a>

本報導資料來源:網頁研習室

請按瀏覽器的檢視原始碼查看