I want to know or catch the fact for placing javascript code in body tag or head tag. When will I put my javascript function in head tag section? When will I put my javascript function in body tag section?
You'll notice that sometimes you'll have to some code in head tag section and sometimes in body sections. if you view sources of this forum page, you'll find some javascript code before </head> tag and some code after <body> tag... I did not understand this condition yet in my javascript book. for example: few days ago I developed a slideshow based RSS,php, javascript application. In that application I was writing array inside <head> tag. My question why are we writing inside head section ? Can't we place them in body? mainly i used an opensource script here. they guide me to place some code at before head tag and some after body tag.. if we can't, so what will remind us that we have to place javascript code inside head or body?