Solved

Runtime error for JavaScript

Posted on 2004-08-11
11
539 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
ID: 11774270
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
ID: 11774419
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
ID: 11774746
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
ID: 11779200
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
ID: 11786276
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 36

Expert Comment

by:Zyloch
ID: 11786408
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
ID: 11792852
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
ID: 11862138
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
ID: 11869775
Thanks for the help.  Problem was with URL Scan blocking .js files.

Thanks.
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12108902
PAQed, with points refunded (125)

Computer101
E-E Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PHP PDO get the error if exists 3 69
Magento Indexing 1 89
ColdFusion Rereplace 3 71
Cordova Camera plugin fails 2 93
Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to dynamically set the form action using jQuery.

911 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

17 Experts available now in Live!

Get 1:1 Help Now