Is it bad practice to embed JavaScript into the body of HTML?

前端 未结 17 2515
梦谈多话
梦谈多话 2020-12-13 01:44

A team that I am working on has gotten into the habit of using

17条回答
  •  渐次进展
    2020-12-13 02:09

    It's certainly legal; I've seen it on a few pages here on Exforsys for example.

    Now this is a tutorial site showing the basics of HTML and JavaScript so in that context it's perfectly understandable. However, I wouldn't like to see it in production code for anything more than a simple statement or two. Without seeing what you've replaced by // Some JavaScript code here I wouldn't like to comment.

    There shouldn't be any browser issues with this though.

提交回复
热议问题