Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > errors when loading my .js external file

Reply
Thread Tools

errors when loading my .js external file

 
 
FBro
Guest
Posts: n/a
 
      02-03-2008
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\Temp orary ASP.NET Files
\root\6227d372\8fa8293\App_Code.1g3nc3r1.1.js(11,1 2) : error JS1135:
Variable 'System' has not been declared
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temp orary ASP.NET Files
\root\6227d372\8fa8293\App_Code.1g3nc3r1.1.js(11,1 2) : 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
 
Reply With Quote
 
 
 
 
VK
Guest
Posts: n/a
 
      02-03-2008
On Feb 3, 8:50 pm, FBro <bro2...@gmail.com> 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 yourn...@yourISP.com
> (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;
}
}
 
Reply With Quote
 
 
 
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      02-03-2008
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
External file loading question M HTML 1 08-03-2007 06:44 PM
loading contents of external file into div via iframe crescent_au@yahoo.com Javascript 0 12-06-2006 05:09 AM
Create references to external scipt files from within an external script file Mellow Crow Javascript 6 11-04-2005 01:16 PM
loading a string from an external file mr_burns Javascript 1 04-05-2004 03:41 PM
Errors, errors, errors Mark Goldin ASP .Net 2 01-17-2004 08:05 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57