开发者

Is JavaScript necessary to learn ,to use all HTML 5 features?

These days I am learning HTML5 new element where I read that the canvas tag is only a container for graphics, you must use a script to actually paint graphics. so I want to know that Is JavaScript necessary to learn ,to use all HTML 5 features?

If yes than for which tags of HTML5 , JavaScript 开发者_StackOverflow社区knowledge will be needed?


If you want to use all HTML 5 features then, yes, you have to learn javascript because some of them rely on javascript like Local Storage and the WebSocket API.


No, there are various features of HTML5 which are not JavaScript dependent; for example, new tags like <article>, <header>, <footer>, etc.

On your particular example of the canvas, you don't even need to access it through JavaScript - Processing.js makes is a great for programmers and non-programmers alike and is very easy to start with.


No, Javascript is not needed to learn HTML 5. In fact, it is advisable to separate Javascript from HTML 5. Naturally, Javascript can alter the structure and it is a good thing to be fluent in Javascript, but you can implement only the structure and a teammate might be responsible of the scripts.

Let's suppose you need a canvas like this:

 <canvas id="myCanvas" width="200" height="100" style="border:1px solid #000000;">
</canvas> 

Let's suppose further, that you need to draw a rectangle, like this:

var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.fillStyle = "#FF0000";
ctx.fillRect(0,0,150,75);

Nobody prevents your team of implementing a .js file where the js code is included and of you using a script tag inside your structure, having the src attribute pointing to the .js file.

Long story short: You do not need to learn or understand Javascript to be able to work with HTML 5, but it is a nice thing to know. You need Javascript to develop a website though, so at least a basic knowledge about the language would not hurt.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜