School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!
Welcome to Dream.In.Code
Become an Expert!

Join 340,115 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 4,322 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

#1 ashishshevale  Icon User is offline

  • D.I.C Head
  • PipPip
  • Group: Members
  • Posts: 91
  • Joined: 13-April 09


Dream Kudos: 0

Posted 28 May 2009 - 03:00 AM

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

Was This Post Helpful? 0
  • +
  • -


#2 nbarten  Icon User is offline

  • D.I.C Head
  • PipPip
  • Group: Members
  • Posts: 154
  • Joined: 30-April 07


Dream Kudos: 0

Posted 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.
Was This Post Helpful? 0
  • +
  • -

#3 ashishshevale  Icon User is offline

  • D.I.C Head
  • PipPip
  • Group: Members
  • Posts: 91
  • Joined: 13-April 09


Dream Kudos: 0

Posted 28 May 2009 - 03:41 AM

View Postnbarten, on 28 May, 2009 - 03:05 AM, said:

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
Was This Post Helpful? 0
  • +
  • -

#4 nbarten  Icon User is offline

  • D.I.C Head
  • PipPip
  • Group: Members
  • Posts: 154
  • Joined: 30-April 07


Dream Kudos: 0

Posted 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.
Was This Post Helpful? 0
  • +
  • -

#5 ashishshevale  Icon User is offline

  • D.I.C Head
  • PipPip
  • Group: Members
  • Posts: 91
  • Joined: 13-April 09


Dream Kudos: 0

Posted 28 May 2009 - 04:23 AM

View Postnbarten, on 28 May, 2009 - 03:59 AM, said:

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
Was This Post Helpful? 0
  • +
  • -

#6 nbarten  Icon User is offline

  • D.I.C Head
  • PipPip
  • Group: Members
  • Posts: 154
  • Joined: 30-April 07


Dream Kudos: 0

Posted 28 May 2009 - 04:42 AM

Well, i only found this:

http://www.jonathanb..._debug_jav.html

However i still recommand using Firefox for the development part... just test it also often in IE.
Was This Post Helpful? 1
  • +
  • -

#7 ashishshevale  Icon User is offline

  • D.I.C Head
  • PipPip
  • Group: Members
  • Posts: 91
  • Joined: 13-April 09


Dream Kudos: 0

Posted 28 May 2009 - 04:53 AM

View Postnbarten, on 28 May, 2009 - 04:42 AM, said:

Well, i only found this:

http://www.jonathanb..._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
Was This Post Helpful? 0
  • +
  • -

#8 forest51690  Icon User is offline

  • D.I.C Head
  • Icon
  • Group: Contributors
  • Posts: 161
  • Joined: 20-March 09


Dream Kudos: 50

Posted 28 May 2009 - 07:55 AM

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
Was This Post Helpful? 1
  • +
  • -

#9 PsychoCoder  Icon User is offline

  • apt-get install DIC.bin
  • Icon
  • View blog
  • Group: Admins
  • Posts: 16,211
  • Joined: 26-July 07


Dream Kudos: 12400

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net, jQuery

Posted 28 May 2009 - 07:57 AM

Develop in Firefox and use the IE Tab plugin :)
Was This Post Helpful? 0
  • +
  • -

#10 Smurphy  Icon User is online

  • D.I.C Regular
  • Icon
  • View blog
  • Group: Members w/DIC++
  • Posts: 292
  • Joined: 07-July 08


Dream Kudos: 25

Posted 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.
Was This Post Helpful? 0
  • +
  • -

#11 ashishshevale  Icon User is offline

  • D.I.C Head
  • PipPip
  • Group: Members
  • Posts: 91
  • Joined: 13-April 09


Dream Kudos: 0

Posted 28 May 2009 - 08:30 PM

View PostSmurphy, on 28 May, 2009 - 12:16 PM, said:

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

View PostPsychoCoder, on 28 May, 2009 - 07:57 AM, said:

Develop in Firefox and use the IE Tab plugin :)

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
Was This Post Helpful? 0
  • +
  • -

#12 ultimateweb  Icon User is offline

  • New D.I.C Head
  • Pip
  • Group: Members
  • Posts: 37
  • Joined: 24-May 09


Dream Kudos: 0

Posted 29 May 2009 - 05:56 AM

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.
Was This Post Helpful? 0
  • +
  • -

#13 forest51690  Icon User is offline

  • D.I.C Head
  • Icon
  • Group: Contributors
  • Posts: 161
  • Joined: 20-March 09


Dream Kudos: 50

Posted 01 June 2009 - 12:04 PM

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 :)
Was This Post Helpful? 0
  • +
  • -



Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



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