Solved

Runtime error for JavaScript

Posted on 2004-08-11
11
554 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
ColdFusion Rereplace 3 98
Examples of Web API, REST web services and SOA 7 460
CSS display:none AND display:block on same element 3 125
MediaWiki - Move a site 4 56
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

710 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