"should be in the head area of the document." No it shouldn't. You can put it in the head if you like, but Javascript blocks downloads, it's ideally a behavior layer that enhances presentation, etc. Much has been written about putting js at the close of the body as a best practice: http://developer.yahoo.com/performance/rules.html#js_bottom
Whether at the top or bottom, your script will fail if you don't include it in the correct order. room.js requires jQuery, but is being requested before the jQuery library. On Jun 7, 7:08 am, jerome <m...@amosdesigns.net> wrote: > <script src="js/room.js" type="text/javascript"></script> > <script src="js/jquery-1.3.2.min.js" type="text/javascript"></ > script> > should be in the head area of the document. > > ----- Original Message ----- > From: "dotnet" <caiyu...@gmail.com> > To: "jQuery (English)" <jquery-en@googlegroups.com> > Sent: Saturday, June 06, 2009 1:19 PM > Subject: [jQuery] who cann't i make it work?my first jquery aspx page > > > <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Chat.aspx.cs" > > Inherits="Chat" %> > > <%@ Import Namespace="OLChatRoom" %> > > > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:// > >www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> > > <html xmlns="http://www.w3.org/1999/xhtml"> > > <head runat="server"> > > <title>. . . .</title> > > <link href="~/stylesheet/chatroom.css" type="text/css" > > rel="stylesheet" /> > > my .aspx page: > > </head> > > <body> > > <form id="form1" runat="server"> > > <input id="hiddenID" type="hidden" name="hiddenID" > > runat="server"/> > > <asp:ScriptManager ID="ScriptManager1" runat="server" > > EnablePartialRendering="True" EnablePageMethods="True"> > > > </asp:ScriptManager> > > <div id="status"><ul><li>the person u r chatting to is from > > <asp:Label ID="country" runat="server" Text="an unknown place"></ > > asp:Label></li><li id="tyingStatus"></li></ul></div> > > <div id="txt"><P></P></div> > > <div id="Operation"> > > <p id="contenterea"><textarea id="txtMsg" cols="91" rows="5"></ > > textarea></p> > > <div id="clickerea"><div><input id="btn" type="button" value="S E > > N D"/></div><div><input id="stp" type="button" value="Stopit" /></ > > div></div></div> > > </form> > > <script src="js/room.js" type="text/javascript"></script> > > <script src="js/jquery-1.3.2.min.js" type="text/javascript"></ > > script> > > </body> > > </html> > > > my room.js: > > $(document).ready(function(){alert("myfirstjquery");}) > > > but when i run the .aspx with IE, alert window of alert > > ("myfirstjquery") doesn't show up.but when i wrap $(document).ready > > (function(){alert("myfirstjquery");}) in a function and invoke it in > > the event "onload()" of the <body> ,it works fine. > > i was told $(document).ready() is the execute after the page loaded .