School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 306,811 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,695 people online right now. Registration is fast and FREE... Join Now!




which is good to put a script tag in <head> or <body> tag

 

which is good to put a script tag in <head> or <body> tag

ashishshevale

28 May, 2009 - 03:00 AM
Post #1

D.I.C Head
**

Joined: 13 Apr, 2009
Posts: 91



Thanked: 3 times
My Contributions
I am new to javascript and want to know more about it
I have a basic question
which is good writing script tag in <head> or <body> tag
also what are there pros and cons
also it is hard to debug javascript codes in visual studio 2005 so is there any debuger available
for this project I have to use ie though I like firefox
lol

This post has been edited by ashishshevale: 28 May, 2009 - 03:12 AM

User is offlineProfile CardPM
+Quote Post


nbarten

RE: Which Is Good To Put A Script Tag In <head> Or <body> Tag

28 May, 2009 - 03:05 AM
Post #2

D.I.C Head
**

Joined: 30 Apr, 2007
Posts: 154



Thanked: 4 times
My Contributions
well i'm not that long in javascript... but i guess most of the time scripts (like functions) are set in the <head> tag.

If you want a debugger, you can use the Firebug Add-On for firefox.
User is offlineProfile CardPM
+Quote Post

ashishshevale

RE: Which Is Good To Put A Script Tag In <head> Or <body> Tag

28 May, 2009 - 03:41 AM
Post #3

D.I.C Head
**

Joined: 13 Apr, 2009
Posts: 91



Thanked: 3 times
My Contributions
QUOTE(nbarten @ 28 May, 2009 - 03:05 AM) *

well i'm not that long in javascript... but i guess most of the time scripts (like functions) are set in the <head> tag.

If you want a debugger, you can use the Firebug Add-On for firefox.

for this project I have to use ie though I like firefox
lol

User is offlineProfile CardPM
+Quote Post

nbarten

RE: Which Is Good To Put A Script Tag In <head> Or <body> Tag

28 May, 2009 - 03:59 AM
Post #4

D.I.C Head
**

Joined: 30 Apr, 2007
Posts: 154



Thanked: 4 times
My Contributions
So you aren't able to use Firefox for just development? (just test it sometimes in IE too so you are sure it works both in FF and IE).

I don't IE has a good debugger for javascript itself.
User is offlineProfile CardPM
+Quote Post

ashishshevale

RE: Which Is Good To Put A Script Tag In <head> Or <body> Tag

28 May, 2009 - 04:23 AM
Post #5

D.I.C Head
**

Joined: 13 Apr, 2009
Posts: 91



Thanked: 3 times
My Contributions
QUOTE(nbarten @ 28 May, 2009 - 03:59 AM) *

So you aren't able to use Firefox for just development? (just test it sometimes in IE too so you are sure it works both in FF and IE).

I don't IE has a good debugger for javascript itself.

yes ie does have, I tried it but I want a line by line kind of debuger and ie does not suport it if you have syntax eror for a function
it suports for runtime erors
so asking for any external debuger or ide so that I can put watch on variables and such
User is offlineProfile CardPM
+Quote Post

nbarten

RE: Which Is Good To Put A Script Tag In <head> Or <body> Tag

28 May, 2009 - 04:42 AM
Post #6

D.I.C Head
**

Joined: 30 Apr, 2007
Posts: 154



Thanked: 4 times
My Contributions
Well, i only found this:

http://www.jonathanboutelle.com/mt/archive..._debug_jav.html

However i still recommand using Firefox for the development part... just test it also often in IE.
User is offlineProfile CardPM
+Quote Post

ashishshevale

RE: Which Is Good To Put A Script Tag In <head> Or <body> Tag

28 May, 2009 - 04:53 AM
Post #7

D.I.C Head
**

Joined: 13 Apr, 2009
Posts: 91



Thanked: 3 times
My Contributions
QUOTE(nbarten @ 28 May, 2009 - 04:42 AM) *

Well, i only found this:

http://www.jonathanboutelle.com/mt/archive..._debug_jav.html

However i still recommand using Firefox for the development part... just test it also often in IE.

thanks
but I wil stil prefer an external or a third party (hopefuly opensource lol) ide or debuger
I have restricted rights as working on companys computer so have to use ie only
anyways answer of my first question
which is good writing script tag in <head> or <body> tag
I stil couldnt find it
User is offlineProfile CardPM
+Quote Post

forest51690

RE: Which Is Good To Put A Script Tag In <head> Or <body> Tag

28 May, 2009 - 07:55 AM
Post #8

D.I.C Head
Group Icon

Joined: 20 Mar, 2009
Posts: 130



Thanked: 20 times
Dream Kudos: 50
My Contributions
hey Ashish,

A script tag can either go in the head or the body section of a web page. Both have their uses, but they behave differently. When a script is put in the head section, it executes before the document is fully loaded. When it is in the body section, it executes when that portion of the page loads.

So note that when a script is put in the head without any kind of onload event, it shouldn't try to get or edit any element of the document, because the document doesn't exist yet and you'll get an error.

Hope it helps
User is offlineProfile CardPM
+Quote Post

PsychoCoder

RE: Which Is Good To Put A Script Tag In <head> Or <body> Tag

28 May, 2009 - 07:57 AM
Post #9

I Code, Therefore I am
Group Icon

Joined: 26 Jul, 2007
Posts: 14,919



Thanked: 517 times
Dream Kudos: 11525
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net, jQuery

My Contributions
Develop in Firefox and use the IE Tab plugin smile.gif
User is offlineProfile CardPM
+Quote Post

Smurphy

RE: Which Is Good To Put A Script Tag In <head> Or <body> Tag

28 May, 2009 - 12:16 PM
Post #10

D.I.C Regular
Group Icon

Joined: 7 Jul, 2008
Posts: 261



Thanked: 11 times
Dream Kudos: 25
My Contributions
Get the firebug addon for firefox. It allows you to traverse all the html css and script on a page. Also it comes with a javascript debugger that works fairly well. I use it all the time. Wonderful tool.
User is offlineProfile CardPM
+Quote Post

ashishshevale

RE: Which Is Good To Put A Script Tag In <head> Or <body> Tag

28 May, 2009 - 08:30 PM
Post #11

D.I.C Head
**

Joined: 13 Apr, 2009
Posts: 91



Thanked: 3 times
My Contributions
QUOTE(Smurphy @ 28 May, 2009 - 12:16 PM) *

Get the firebug addon for firefox. It allows you to traverse all the html css and script on a page. Also it comes with a javascript debugger that works fairly well. I use it all the time. Wonderful tool.

and
QUOTE(PsychoCoder @ 28 May, 2009 - 07:57 AM) *

Develop in Firefox and use the IE Tab plugin smile.gif

thanks both of you but as I have previously said I canot use firefox as working in company and do not have admin rights here
so I asked for third party debuger or a new ide avaliability
User is offlineProfile CardPM
+Quote Post

ultimateweb

RE: Which Is Good To Put A Script Tag In <head> Or <body> Tag

29 May, 2009 - 05:56 AM
Post #12

New D.I.C Head
*

Joined: 24 May, 2009
Posts: 37



Thanked: 2 times
My Contributions
Pernally i would put it between the <head></head> tags because 1)I was thougt that way and 2) It executes before the page loads fully.
User is offlineProfile CardPM
+Quote Post

forest51690

RE: Which Is Good To Put A Script Tag In <head> Or <body> Tag

1 Jun, 2009 - 12:04 PM
Post #13

D.I.C Head
Group Icon

Joined: 20 Mar, 2009
Posts: 130



Thanked: 20 times
Dream Kudos: 50
My Contributions
Hey Ashish,

So I heard that you couldn't use Firefox because you work at a company and you can't install it, right?
Well I have some great news. There is a portable version of Firefox, which means that you don't have to have Administrative rights to install it. You can find it and other portable applications at portableapps.com. Enjoy smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/20/09 09:53PM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month