January 4th, 2013, 02:15 AM
HTML5 instruction doesn't make sense to me.
Hi. I'm learning HTML5 online but have poor knowledge about IT terms. A lot of instructions doesn't make sense to me and have to take time to figure out what each term means.
But I couldn't find out what this means on google, so I'm hoping to get some help from people here who were supposed to know a lot about IT terms.
Okay, this instruction says:
1. "Retrieve a reference to the canvas element"
2. "Get the drawing context from the element using getContext()"
And I don understand what "retrieving a reference to the canvas element" means. I can't picture me retrieving a reference to an element...
I don't understand what "context" in this context either.
Could anyone please tell me what those words in this instruction mean as if you are trying to teach a 9 year old what they mean??
I don't think I have enough IT literacy..
January 4th, 2013, 03:23 AM
It is not technical speak, it is just the bad way the people describe things in their tutorials.
Where the id of your canvas area on the page is called 'myCanvas'
var canvas = document.getElementById("myCanvas");
2. Get the drawing context from the element using getContext() - This just means the type of drawing you will have on your canvas but only '2d' is currently available at the moment anyway.
Hope this helps.
January 4th, 2013, 12:40 PM
That's one of the odd things about HTML5: they mix the new DOM documentation right in with the HTML documentation. Previously the DOM documentation was separate. When it comes to understanding the DOM documentation in the HTML5 spec, the two most relevant DOM modules are:
January 7th, 2013, 07:16 AM
That really makes sense.
A reference = A ID or Classes.
Context = Type of Drawing.
Originally Posted by simplypixie
January 7th, 2013, 07:26 AM
Yeah that's really taxing for me who are not familier with JS and DOM.
So in this case, a reference is ID, right??
Originally Posted by Kravvitz
January 7th, 2013, 09:15 PM
No. A web page is full of elements. If we want to manipulate an element then we usually create a variable that refers to that element. One way to refer to an element is by using its ID (if it has one). The ID itself is just a value.
<canvas id="theCanvas" width="300" height="200"></canvas>
var refersToCanvas = document.getElementById('theCanvas');
// now we can manipulate the canvas, using the variable
refersToCanvas.className = "newclass";
// another way, if this is the first canvas on the page:
var alsoRefers = document.getElementsByTagName('canvas');
extension is deprecated as of PHP 5.5.0, and is not recommended for writing new code as it will be removed in the future. Instead, either the mysqli or PDO_MySQL extension should be used." the docs
January 8th, 2013, 07:06 PM
Yeah, I meant that an ID is used as a reference.
To grab element, we use ID as a reference for the element, right??
Originally Posted by AndrewSW