errors when loading my .js external file

Discussion in 'Javascript' started by FBro, Feb 3, 2008.

  1. FBro

    FBro Guest

    Source code:
    Line 11: {
    Line 12: oForm.requiredemail.className='backclrPink';
    Line 13: alert("The e-mail address you entered is not valid. Please
    re-enter your e-mail. The format should be like
    (or .net, or .org, etc.)");

    Error message:
    Compiler Error Message: JS1135: Variable 'alert' has not been
    declared

    Clicking on Show Detailed Compiler Output:
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
    \root\6227d372\8fa8293\App_Code.1g3nc3r1.1.js(11,12) : error JS1135:
    Variable 'System' has not been declared
    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
    \root\6227d372\8fa8293\App_Code.1g3nc3r1.1.js(11,12) : error JS1146:
    Unknown custom attribute class or constructor
    d:\hosting\bro2000az\App_Code\formValid.js(13,3) : error JS1135:
    Variable 'alert' has not been declared
    d:\hosting\bro2000az\App_Code\formValid.js(85,22) : warning JS1187:
    Variable 'tempobj' might not be initialized
    d:\hosting\bro2000az\App_Code\formValid.js(86,9) : warning JS1187:
    Variable 'tempobj' might not be initialized
    d:\hosting\bro2000az\App_Code\formValid.js(2,1) : error JS1234: Only
    type and package definitions are allowed inside a library


    My request is for someone to help me solve the problem indicated
    above.
    When I run this using IIS on my computer I do not get this error.
    "formValid.js" is where all of the javascript is located. It is
    referenced on the .aspx page like this:
    <script type="text/javascript" src="..\App_Code\formValid.js"/>

    Thank you for any help you offer.
    Fred
    FBro, Feb 3, 2008
    #1
    1. Advertising

  2. FBro

    VK Guest

    On Feb 3, 8:50 pm, FBro <> wrote:
    > Source code:
    > Line 11: {
    > Line 12: oForm.requiredemail.className='backclrPink';
    > Line 13: alert("The e-mail address you entered is not valid. Please
    > re-enter your e-mail. The format should be like
    > (or .net, or .org, etc.)");
    >
    > Error message:
    > Compiler Error Message: JS1135: Variable 'alert' has not been
    > declared


    alert, confirm, prompt are not native Javascript methods: they are
    methods of window host object so they really are window.alert,
    window.confirm, window.prompt
    It is just common yet not suggested shortcut to use them without
    indicating the parent object. If there is not window, then where is
    not such methods as you may guess.
    To pass over Visual Studio compilation you may add at the beginning of
    your file something like:

    if (typeof alert == 'undefined') {
    var alert : new Function;
    var confirm : new Function;
    var prompt : new Function;
    var window = {
    'alert' : alert;
    'confirm' : confirm;
    'prompt' : prompt;
    }
    }
    VK, Feb 3, 2008
    #2
    1. Advertising

  3. FBro wrote:
    > Source code:
    > Line 11: {
    > Line 12: oForm.requiredemail.className='backclrPink';
    > Line 13: alert("The e-mail address you entered is not valid. Please
    > re-enter your e-mail. The format should be like
    > (or .net, or .org, etc.)");
    >
    > Error message:
    > Compiler Error Message: JS1135: Variable 'alert' has not been
    > declared


    Sigh. [psf 10.1]

    `alert' is a method of a host-defined property (`window') of the Global
    Object that is available client-side only. ASP .NET is server-side.

    You are the second person this week to ask such a question. Please search
    before you post.

    > When I run this using IIS on my computer I do not get this error.
    > "formValid.js" is where all of the javascript is located. It is
    > referenced on the .aspx page like this:
    > <script type="text/javascript" src="..\App_Code\formValid.js"/>


    http://validator.w3.org/ applied to the response probably shows why that is
    wrong.

    Why do people have to mess around with things before they got the basics?
    Has an ASP .NET class started recently?


    PointedEars
    --
    var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
    ) // Plone, register_function.js:16
    Thomas 'PointedEars' Lahn, Feb 3, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Goldin

    Errors, errors, errors

    Mark Goldin, Jan 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    920
    Mark Goldin
    Jan 17, 2004
  2. M
    Replies:
    1
    Views:
    345
    Ed Mullen
    Aug 3, 2007
  3. mr_burns

    loading a string from an external file

    mr_burns, Apr 4, 2004, in forum: Javascript
    Replies:
    1
    Views:
    90
    Brian Genisio
    Apr 5, 2004
  4. Mellow Crow
    Replies:
    6
    Views:
    407
    Richard Cornford
    Nov 4, 2005
  5. Replies:
    0
    Views:
    91
Loading...

Share This Page