※Js關閉瀏覽器視窗 - IE、Chrome、Safari、Firefox
※Firefox必須將偏好設定 dom.allow_scripts_to_close_windows設定為true,才能以Js關閉視窗。
※Firefox必須將偏好設定 dom.allow_scripts_to_close_windows設定為true,才能以Js關閉視窗。
< div id="outer">
< div id="inner">Element to be aligned< /div>
< /div>
#outer {
display: table;
width: 100%;
height: 100%; /* Height can be anything */
}
#inner {
display: table-cell;
vertical-align: top;
}
< meta http-equiv="X-UA-Compatible" content="requiresActiveX=true" >
< !DOCTYPE HTML>
< html>
< head>
< meta charset="utf-8">
< title>無標題文件< /title>
< style type="text/css">
#canvas1 {
color: #000000;
font-size: 100px;
background-color: #000000;
border: medium dotted #ffffff;
}
body {
background-color: #000000;
}
< /style>< /head>
< body>
< canvas id="canvas1" width="550" height="400">< /canvas>
< script language="javascript">
//
var canvas = document.getElementById("canvas1");
var context = canvas.getContext("2d");
//
var image = new Image();
image.onload = function(){
context.drawImage(image,0,0,canvas.width,canvas.height);
};
image.src = "nv007-001a.jpg";
< /script>
< /body>
< /html>
< canvas id="canvas1" width="550" height="400">< /canvas>
var canvas = document.getElementById("canvas1");
var context = canvas.getContext("2d");
context.fillStyle = "#aabbff";
context.fillRect(100,100,100,100)
context.fillStyle = "#ffffff";
context.fillText("Hello World!!!",150,130);
HTML 5 新增 < canvas> 標籤。 藉由JavaScript 操作 HTML DOM CanvasRenderingContext2D 對象所提供的一組繪圖 API, 達到在畫布上繪圖的目的。 A.在html5中加入
< !DOCTYPE HTML>
< html>
< head>
< meta charset="utf-8">
< title>無標題文件< /title>
< style type="text/css">
#canvas1 {
color: #000000;
font-size: 100px;
background-color: #FC0;
border: medium dotted #036;
}
< /style>< /head>
< body>
< canvas id="canvas1" width="550" height="400">< /canvas>
< script language="javascript">
//
var canvas = document.getElementById("canvas1");
var context = canvas.getContext("2d");
//
context.fillStyle = "#aabbff";
context.fillRect(100,100,100,100)
context.fillStyle = "#ffffff";
context.fillText("Hello World!!!",150,130);
< /script>
< /body>
< /html>