Site Search

2011-06-21

HTML5: The body element is optional


You can omit the <body> and even the <html> element itself in HTML5. However if you want to use <body>'s onload event, you can replace it by window's onload event and assign the JavaScript function you want to call (when the document is loaded) as stated below: 

window.onload = function() { /* anonymous function directives */ };