<html>
<head>
<title>Wormhole</title>
</head>
<body οnlοad="main()">
<canvas id="example" width="400" height="400"></canvas>
<script src="DrawRecting.js"></script>
</body>
</html>
login.jsp
function main(){
var canvas = document.getElementById('example');
if(!canvas){
console.log('fail to ret the canvas');
return;
}
var ctx = canvas.getContext('2d');
ctx.fillStyle = 'rgba(0,0,255,1.0)';
ctx.fillRect(120,10,150,150);
}
drawrecting.js