Javascript going to the wrong place?

Discussion in 'ASP .Net' started by shapper, Nov 24, 2007.

  1. shapper

    shapper Guest

    Hello,

    I used the following:

    Page.ClientScript.RegisterClientScriptInclude(Me.GetType(),
    "Wait", "~/App_Scripts/Wait.js")
    Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), "Hello",
    "Alert('Hello World');", True)

    On Page_Load (also tried Page_Init and Page_Prerender)

    In both cases the reference and the script were placed inside the
    <body> tag?

    Shouldn't it be in the <head> tag?

    How can I solve this?

    My rendered HTML code:

    <head>
    <title>
    Default
    </title>
    </head>
    <body>
    <form name="form1" method="post" action="Default.aspx" id="form1">
    <div>
    <input name="__VIEWSTATE" id="__VIEWSTATE" value="/
    wEPDwUJMTk5MjU0MTcwZGTUsWGyZF9Fo8xcBZKocDiHxhClIA==" type="hidden">
    </div>
    <script src="%7E/App_Scripts/JQuery.js" type="text/javascript">
    </script>
    <script type="text/javascript">
    //<![CDATA[
    alert('Hello World)'$(document).ready(function(){
    $('#tableone').tableHover();
    });
    //]]>
    </script>
    </form>
    </body>

    Thanks,

    Miguel
     
    shapper, Nov 24, 2007
    #1
    1. Advertisements

  2. Why? What difference does it make?
    Is your JavaScript not working, then...?
     
    Mark Rae [MVP], Nov 24, 2007
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.