Solved

Runtime error for JavaScript

Posted on 2004-08-11
11
537 Views
Last Modified: 2008-01-09
Im sure there is a reasonable answer to this question, thanks for any help in advance:

Furthermore, I am getting a runtime error when running a frame based JavaScript menu.  The runtime error only appears when the page is run from our current web server running NT 4.0 SP6 with IIS.  I want to reiterate that I have published the same code on our intranet and www.geocities.com/ray_charest with success and no errors...I have not uploaded the full content however.

The error is as follows:

"Line: 2"
"Char: 1"
"Error: Syntax error"
"Code: 0"
"Source: "http://www.skowsavings.com/new/Links.htm"

The site that is suspect is http://www.skowsavings.com/new

After debugging, it appears to be a problem with a script call located in the links.htm page to my js files that are located in the root of the site.  I have also tried isolating them to a separate folder and changing the targets in links.htm with no success.  Please let me know if it would be pertinent to paste the code used in the js files.  Thanks!
0
Comment
Question by:skowsavings
11 Comments
 
LVL 36

Expert Comment

by:Zyloch
Comment Utility
Hi

You can probably post the functions in your js files, that might help. Have you tried isolating the js files to the same folder as the Links.htm to make sure it works?

Regards,
Zyloch
0
 

Author Comment

by:skowsavings
Comment Utility
Zyloch, I have put them in the root of the site, still no go.  The js files are quite long, here is the one function that I call:

function Go(){
      if(!Ldd&&PosStrt){
//document.write("ExpYes="+ExpYes+" NavYes="+NavYes);
//return;
            BeforeStart();
            Crtd=0;Ldd=1;
            status="Building menu";
            FLoc=MenuUsesFrames?parent.frames[FirstLineFrame]:window;
            ScLoc=MenuUsesFrames?parent.frames[SecLineFrame]:window;
            DcLoc=MenuUsesFrames?parent.frames[DocTargetFrame]:window;
            if(MenuUsesFrames){
                  if(!FLoc){FLoc=ScLoc;if(!FLoc){FLoc=ScLoc=DcLoc;if(!FLoc)FLoc=ScLoc=DcLoc=window}}
                  if(!ScLoc){ScLoc=DcLoc;if(!ScLoc)ScLoc=DcLoc=FLoc}
                  if(!DcLoc)DcLoc=ScLoc}
            if(FLoc==ScLoc)AcrssFrms=0;
            if(AcrssFrms)FirstLineHorizontal=MenuFramesVertical?0:1;
            if(Exp6Plus||Opr7){
                  FHtml=FLoc.document.getElementsByTagName("HTML")[0];ScHtml=ScLoc.document.getElementsByTagName("HTML")[0];
                  FCmplnt=FLoc.document.compatMode.indexOf("CSS")==-1?0:1;SCmplnt=ScLoc.document.compatMode.indexOf("CSS")==-1?0:1}
            FWinW=ExpYes?FCmplnt?FHtml.clientWidth:FLoc.document.body.clientWidth:FLoc.innerWidth;
            FWinH=ExpYes?FCmplnt?FHtml.clientHeight:FLoc.document.body.clientHeight:FLoc.innerHeight;
//document.write(FWinH);
            SWinW=ExpYes?SCmplnt?ScHtml.clientWidth:ScLoc.document.body.clientWidth:ScLoc.innerWidth;
            SWinH=ExpYes?SCmplnt?ScHtml.clientHeight:ScLoc.document.body.clientHeight:ScLoc.innerHeight;
            FColW=Nav4?FLoc.document:FLoc.document.body;
            SColW=Nav4?ScLoc.document:ScLoc.document.body;
            DColW=Nav4?DcLoc.document:ScLoc.document.body;
            if(TakeOverBgColor){
                  if(ExpYes)FColW.style.backgroundColor=AcrssFrms?SColW.bgColor:DColW.bgColor;
                  else FColW.bgColor=AcrssFrms?SColW.bgColor:DColW.bgColor}
            if(MenuCentered.indexOf("justify")!=-1&&FirstLineHorizontal)ClcJus();
            if(FrstCreat||FLoc==ScLoc)FrstCntnr=CreateMenuStructure("Menu",NoOffFirstLineMenus,null);
            else CreateMenuStructureAgain("Menu",NoOffFirstLineMenus);
            ClcRl();
            if(TargetLoc)ClcTrgt();ClcLft();ClcTp();
            PosMenu(FrstCntnr,StartTop,StartLeft);
            IniFlg=1;Initiate();Crtd=1;
            SLdAgnWin=ExpYes?ScLoc.document.body:ScLoc;
            SLdAgnWin.onunload=Nav4?NavUnLdd:UnLdd;
            if(ExpYes)Trigger.onunload=UnLddTotal;
            Trigger.onresize=Nav4?ReDoWhole:RePos;
            AfterBuild();
            if(RememberStatus)StMnu();
            if(Nav4&&FrstCreat){Trigger.captureEvents(Event.LOAD);Trigger.onload=NavLdd}
            if(FrstCreat)Dummy();FrstCreat=0;
            if(MenuVerticalCentered=="static"&&!AcrssFrms)setInterval("KeepPos()",250);
            status="Menu ready for use"}}
0
 
LVL 36

Expert Comment

by:Zyloch
Comment Utility
I don't think it's the javascript. I don't know where the Go function was, but I do know that your two Js files listed aren't .js files. They're .html. Maybe that's what's causing the problem?
0
 
LVL 18

Expert Comment

by:arantius
Comment Utility
A javascript file called like you have:
<script type='text/javascript' src='SkowSettings_var.js'></script>
Must contain ONLY javascript.  At the site that you have linked, they are HTML pages, and in fact contain no javascript.  The javascript parser reads the first line of that file, which is <html>, and dies, because that string of characters is not valid javascript.
In short, anything in the file pointed to by src must be valid to have gone in between the <script></script>
0
 

Author Comment

by:skowsavings
Comment Utility
Understandable, however it still remains a mystery why I can post this type of syntax on geocities and still have no errors.  Also, what is the reason that I can run this from local disk as well in the browser with no errors?  Do you have any recomendations to get around this error?  thanks.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 36

Expert Comment

by:Zyloch
Comment Utility
Overall, don't link to site like that. Only link to Javascript or VBScript, hence the <script> tag. Move all your relevant Javascript functions to an external .js file (only the Javascript). Then, use <script type="text/javascript" src="externalJSFileName.js"></script> to link to it on every page.

Regards,
0
 

Author Comment

by:skowsavings
Comment Utility
Zyloch, this still gives me no insight as to why the site works fine on other source locations but this one host.  I don't think it's entirly a problem with the code.
0
 
LVL 36

Expert Comment

by:Zyloch
Comment Utility
It could be a server configuration, but then again, it's not standard to have HTML inside your external script files so you can't blame it on the host and make them change it, unfortunately.
0
 

Author Comment

by:skowsavings
Comment Utility
Thanks for the help.  Problem was with URL Scan blocking .js files.

Thanks.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
Comment Utility
PAQed, with points refunded (125)

Computer101
E-E Admin
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Article by: Matthew
I am a very big proponent of technology compliance standards and strive to meet such criteria in all of my work. That includes my site, which is 100% XHTML 1.0 compliant as determined by the World Wide Web Consortium. https://www.matthewstevenkel…
There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now