Skip to content

Instantly share code, notes, and snippets.

View nextechu's full-sized avatar

Bruce Kyle nextechu

View GitHub Profile
<body>
<canvas id="myCanvas" width="578" height="200"></canvas>
</body>
<!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);
context.fillRect(25,25,100,100);
context.clearRect(45,45,60,60);
context.strokeRect(50,50,50,50);
context.beginPath();
context.lineWidth = 10;
context.fillStyle = "blue";
context.arc(305, 135, 10, 0, 360);
context.fill();
context.stroke();
context.closePath();
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
Modernizr.load({
test: Modernizr.canvas,
nope: '../Scripts/excanvas.js',
complete: function () {
Modernizr.load('Scripts/yourdrawing.js');
}
}]);
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 {
var checkedValue = $('[name = "someRadioGroup"]:checked').val();
<!-- 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>
<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>