How to reference External Javascript Files????

  1. #1

    How to reference External Javascript Files????

    1. This works!

    <head id="Head1" runat="server">
        <title>Ext.Net Example</title>
        <ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="ScriptFiles" />
        <script type="text/javascript">
            window.onload = alert('hi there');
        </script>
    </head>

    2. This does not!

    <head id="Head1" runat="server">
        <title>Ext.Net Example</title>
        <ext:ResourcePlaceHolder ID="ResourcePlaceHolder1" runat="server" Mode="ScriptFiles" />
        <script type="text/javascript" language="javascript" src="Scripts/login.js"></script>
        <script type="text/javascript" id="Script1" language="javascript">
            window.onload = nsLogin.TestIt();
        </script>
    </head>


    ******* login.js **********

    var nsLogin = new function () {
    
        this.TestIt = function () { alert('hi there'); }
    
    }

    ***********************

    IE 7 (doesn't work)
    IE 9 (doesn't work)
    VS 2010
    .Net Framework 4
    Ext.Net 1.2.0.21945
    Attached Thumbnails jsFileError.jpg  
    Last edited by geoffrey.mcgill; Dec 07, 2011 at 3:41 AM. Reason: please use [CODE] tags
  2. #2
    Hi,

    The code you have posted appears to be correct. There are no obvious problems.

    I'd tripple check that "Scripts/login.js" is the correct path, and ensure the file is actually being loaded in the browser properly.

    Hope this helps.
    Geoffrey McGill
    Founder & CEO

Similar Threads

  1. Replies: 7
    Last Post: Jul 31, 2012, 9:31 PM
  2. [CLOSED] XScript with referenced javascript files
    By rthiney in forum 1.x Premium Help
    Replies: 1
    Last Post: Jun 07, 2011, 2:32 PM
  3. Using javascript.js files in ext:XScript
    By kutlu in forum 1.x Help
    Replies: 6
    Last Post: Dec 17, 2010, 11:17 PM
  4. Add a tab to tabpanel from external page
    By marcozzz in forum 1.x Help
    Replies: 0
    Last Post: Feb 16, 2010, 9:48 AM
  5. Replies: 2
    Last Post: Aug 07, 2008, 4:35 PM

Tags for this Thread

Posting Permissions