This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<canvas id="myCanvas" width="578" height="200"></canvas> | |
</body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<script> | |
window.onload = function() { | |
var canvas = document.getElementById("myCanvas"); | |
var context = canvas.getContext("2d"); | |
// Write on the canvas here | |
context.moveTo(100, 150); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context.fillRect(25,25,100,100); | |
context.clearRect(45,45,60,60); | |
context.strokeRect(50,50,50,50); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context.beginPath(); | |
context.lineWidth = 10; | |
context.fillStyle = "blue"; | |
context.arc(305, 135, 10, 0, 360); | |
context.fill(); | |
context.stroke(); | |
context.closePath(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
context.save(); | |
// rotate the context to draw at an angle | |
// the rotation is in radians | |
var degrees = 55; | |
context.rotate(degrees * 0.01745); | |
context.fillText("Main St", 150, -165); | |
// restore the context |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Modernizr.load({ | |
test: Modernizr.canvas, | |
nope: '../Scripts/excanvas.js', | |
complete: function () { | |
Modernizr.load('Scripts/yourdrawing.js'); | |
} | |
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var checkedValue; | |
var elements = document.getElementsByTagName('input'); | |
for (var n = 0; n < elements.length; n++) { | |
if (elements[n].type == 'radio' && | |
element[n].name == 'someRadioGroup' && | |
elements[n] == checked { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var checkedValue = $('[name = "someRadioGroup"]:checked').val(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Google Libraries --> | |
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> | |
<!-- or Microsoft Content Delivery Network --> | |
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.11.0.js"></script> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// Fallback to loading jQuery from a local path if the CDN is unavailable | |
(window.jQuery || document.write('<script src="/scripts/jquery-1.9.0.min.js"><\/script>')); | |
</script> |