Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 589
  • Last Modified:

Runtime error for JavaScript

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
skowsavings
Asked:
skowsavings
1 Solution
 
ZylochCommented:
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
 
skowsavingsAuthor Commented:
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
 
ZylochCommented:
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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
arantiusCommented:
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
 
skowsavingsAuthor Commented:
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
 
ZylochCommented:
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
 
skowsavingsAuthor Commented:
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
 
ZylochCommented:
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
 
skowsavingsAuthor Commented:
Thanks for the help.  Problem was with URL Scan blocking .js files.

Thanks.
0
 
Computer101Commented:
PAQed, with points refunded (125)

Computer101
E-E Admin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now