Jump to content

Quick Function Help


driz

Recommended Posts

Hi I have written this code"

function createHTML5Elements() {	document.createElement("article");	document.createElement("nav");	document.createElement("section");	document.createElement("header");	document.createElement("hgroup");	document.createElement("aside");	document.createElement("footer");}createHTML5Elements();

I'm quite new to working with JS Functions, but will that function be loaded by simply saying e.g. function_name();OR do I have to add it to the body onload???Thanks

Link to comment
Share on other sites

so that last line that I added does execute the code?could you post some examples of how i could run the code before and after, so i can see how its done for learning purposes. thanks.

Link to comment
Share on other sites

<html><head><script type="text/javascript">function saySomething(text){	alert(text);}saySomething("The page hasn't loaded yet...");window.onload = function() { saySomething("Here we are, the page has loaded..."); }</script></head><body><div>This is in the body.</div></body></html>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...