Skip navigation
alessio_92
Currently Being Moderated

"There is a syntax error on line [x]..."

Jan 6, 2012 6:23 AM

Hi,

 

I'm working in Dreamweaver CS5 (as a total novice), and have just received an error message saying "There is a syntax error on line 72. Code hinting may not work until you fix this error."

 

Line 72 in the coding simply says </script>

 

I'm doing everything graphically and haven't put anything into the coding myself, so I have no idea what this is all about, could someone please enlighten me as to what to do?

 

Thanks  

 

Alessio

 
Replies
  • Currently Being Moderated
    Jan 6, 2012 6:37 AM   in reply to alessio_92

    Dear Alessio,

     

    The problem may not be on line 72, but within the script itself. If you want assistance, please let us be privy of the markup and scripts used. The best way to do this is to supply a link to a working online document.

     

    Gramps

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 23, 2012 3:45 PM   in reply to Ben Pleysier

    I was using Dreamweaver CS5 without problem. Today I opened the same website in Dreamweaver 5.5 and it got the following syntax error notice...

     

    There is a syntax error on line 32. Code hinting may not work until you fix this error.

     

    I decided to create a new test.dwt file and I only have a single roll-over image on the page. Nothing else. When I created a page from the test.dwt file, it got the error message above.

     

    In other words, Dreamweaver doesn't like the script that it created to make the roll-over image. Here's the code that creates the error message...

     

    ------------------- Begin Example ---------------------

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/test.dwt" codeOutsideHTMLIsLocked="false" -->

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <!-- InstanceBeginEditable name="doctitle" -->

    <title>Untitled Document</title>

    <!-- InstanceEndEditable -->

    <!-- InstanceBeginEditable name="head" -->

    <!-- InstanceEndEditable -->

    <script type="text/javascript">

    function MM_swapImgRestore() { //v3.0

      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

    }

    function MM_preloadImages() { //v3.0

      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

    }

     

     

    function MM_findObj(n, d) { //v4.01

      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

      if(!x && d.getElementById) x=d.getElementById(n); return x;

    }

     

     

    function MM_swapImage() { //v3.0

      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

    }

    </script>

    </head>

     

     

    <body onload="MM_preloadImages('images/navbar/cda_home-over.gif')">

    <a href="home.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('home','','images/navbar/cda_home-over.gif' ,1)"><img src="images/navbar/cda_home.gif" alt="Home" name="home" width="149" height="33" border="0" id="home" /></a>

    </body>

    <!-- InstanceEnd --></html>

     

    ------------------- End Example ---------------------

     

    As you can see, it's a pretty simple page. Does anyone have any suggestions?

     

    Thanks in advance.

     

    Bill

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 23, 2012 4:06 PM   in reply to MysticKnight

    I think this is the problem...

     

    <!-- InstanceBeginEditable name="head" -->

    <!-- InstanceEndEditable -->

     

    That's exactly how Dreamweaver writes the code when you create a templete. However, I get the syntax error message if I leave it like that. All I did was move the 2nd line, <!-- InstanceEndEditable -->, to the bottom just below </head> and it fixed the syntax error message.

     

    ------------------- Begin Example ---------------------

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/test.dwt" codeOutsideHTMLIsLocked="false" -->

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

    <!-- InstanceBeginEditable name="doctitle" -->

    <title>Untitled Document</title>

    <!-- InstanceEndEditable -->

    <!-- InstanceBeginEditable name="head" -->

    <script type="text/javascript">

    function MM_swapImgRestore() { //v3.0

      var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;

    }

    function MM_preloadImages() { //v3.0

      var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();

        var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)

        if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}

    }

     

     

    function MM_findObj(n, d) { //v4.01

      var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {

        d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

      if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

      for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);

      if(!x && d.getElementById) x=d.getElementById(n); return x;

    }

     

     

    function MM_swapImage() { //v3.0

      var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)

       if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}

    }

    </script>

    </head>

    <!-- InstanceEndEditable -->

     

     

    <body onload="MM_preloadImages('images/navbar/cda_home-over.gif')">

    <a href="home.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('home','','images/navbar/cda_home-over.gif' ,1)"><img src="images/navbar/cda_home.gif" alt="Home" name="home" width="149" height="33" border="0" id="home" /></a>

    </body>

    <!-- InstanceEnd --></html>

     

    ------------------- End Example ---------------------

     

    It seems strange that Dreamweaver would make such an elementary mistake in writing this code. Also, it makes me very nervous moving around code manually in the template that Dreamweaver created to define all the pages at my website.

     

    Does anyone know if there's anything that I could have done wrong that caused this problem when Dreamweaver creates a template?

     

    All the best,

     

    Bill

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 23, 2012 5:28 PM   in reply to MysticKnight

    I think this is the problem...

     

    <!-- InstanceBeginEditable name="head" -->

    <!-- InstanceEndEditable -->

     

    I can confidently tell you that is not the problem.

     

    That's exactly how Dreamweaver writes the code when you create a templete. However, I get the syntax error message if I leave it like that. All I did was move the 2nd line, <!-- InstanceEndEditable -->, to the bottom just below </head> and it fixed the syntax error message.

     

    You just broke your Template by doing that. That code doesn't belong there and will cause DW to give you an error message when you try to save the page.

     

    Is the error on line 72 or line 32?

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 23, 2012 5:52 PM   in reply to MurraySummers

    I can confidently tell you that is not the problem.

     

    The pages that were created with that template stopped giving me the error message once I moved <!-- InstanceEndEditable --> below </head>. As I mentioned before, it does make me nervous manually moving that text, but it also doesn't make sense that those 2 lines of text are together to begin with.

     

    You just broke your Template by doing that. That code doesn't belong there and will cause DW to give you an error message when you try to save the page.

     

    If it's broke, I don't see it. That doesn't mean it's not broke, but everything "seems" to be working correctly now. I don't get the syntax error message when I open the pages that were created from the template. FYI: It was the template file that I modified and not the page that was created from the template file.

     

    Is the error on line 72 or line 32?

     

    The error is the line that has </script>.

     

    Remember for my test, all I did was create a blank web page with nothing on it. I used it as a template and there was no problem. Then I ONLY added one roll-over button, saved the template and when I created a new page from that template, I got the syntax error message at the line that had the closing tag for the roll-over script.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 24, 2012 5:38 AM   in reply to MysticKnight

    it also doesn't make sense that those 2 lines of text are together to begin with.

     

    Of course it does.  It's an empty Editable region that can be used by you or by DW's behaviors to add page-specific behaviors (javascript).  That's how it's suppose to be.  Don't change it.

     

    Obviously there is somethign strange happening here, but it's definitely NOT related to the location of that editable region.  Try this - take the page that you have shown in your post #2, and delete the <title>Untitled Document</title> line.  What happens to the error?  Now undo that deletion.  What happens to that error?  For me, deleting the line causes the error to go away.  Then undoing that deletion doesn't bring the error back.  You get the same effect if you open that page, detach it from the Template with MODIFY > Templates > Detach from Template.  Now undo that operation.  The error is gone!  This is clearly a sign that there is something unexpected in that code.  I'll have to look carefully to figure out what that is.  But once again, it has nothing to do with that Editable region which is properly placed in your code.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 24, 2012 5:43 AM   in reply to MurraySummers

    Here's an even more interesting thing to try - open that page, and add an extra space between "Untitled" and "Document" in the <title> tag.  The error goes away.  Now delete that space.  The error stays away. It's odd....

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 25, 2012 11:39 AM   in reply to MurraySummers

    Obviously there is somethign strange happening here, but it's definitely NOT related to the location of that editable region.

     

    I understand what you're saying that it should not be related to that region, but it's obviously affecting the syntax error message whether it should be doing so or not. In other words, that editable region tag is absolutely related to the problem. How it's related is the mystery.

     

    Try this - take the page that you have shown in your post #2, and delete the <title>Untitled Document</title> line.  What happens to the error?  Now undo that deletion.  What happens to that error?  For me, deleting the line causes the error to go away.  Then undoing that deletion doesn't bring the error back.  You get the same effect if you open that page, detach it from the Template with MODIFY > Templates > Detach from Template.  Now undo that operation.  The error is gone!

     

    I'm getting similar results. When I modify ANYTHING in the header, it temporarily makes the error message go away. However, if you close the document and then reopen it, the error message comes back.

     

    This is clearly a sign that there is something unexpected in that code.  I'll have to look carefully to figure out what that is.

     

    I agree, but keep in mind that there's nothing complex about the page at all. I simply created a new page and added a single roll-over button. Maybe it has something to do with the doctype declaration. For what it's worth, all the code was created by Dreamweaver. Dreamweaver is finding an error in it's own code. It's not like I hand coded it. It's very weird.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 24, 2012 1:15 PM   in reply to MurraySummers

    Here's an even more interesting thing to try - open that page, and add an extra space between "Untitled" and "Document" in the <title> tag.  The error goes away.  Now delete that space.  The error stays away. It's odd....

     

    After the error message goes away, try closing the docment and reopening it. If you get the same results that I did, the error will come back.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 24, 2012 1:18 PM   in reply to MysticKnight

    Hey Murray,

     

    Would you mind trying the same experiment for me...

     

    1. Create a simple page as a template and add just one roll-over button.
    2. Create a new page from that template.
    3. Open that new page and tell me if the syntax error message is there.

     

    I'm curious if you get the same results.

     


    Bill

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 24, 2012 1:49 PM   in reply to MysticKnight

    I'll try that and let you know.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 25, 2012 4:58 AM   in reply to MurraySummers

    OK - I use the following steps on my W7PC:

     

    1.  I create a blank HTML page (HTML5 or XHTML1.0Transitional)

    2.  I insert an image on the page

    3.  I select the image and add a swap image behavior

    4.  I save the resulting page as a template

    5.  I spawn a new child page from this template

     

    DW throws a syntax error message, just as you say.

     

    When I repeat the same steps on my Mac, I do not get that result - there is no syntax error.

     

    This is a bug and I will report it - there is clearly no syntax error there.  As far as I can see, there is no workaround other than to ignore it.  Sorry for your inconvenience.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 28, 2013 8:20 AM   in reply to MurraySummers

    First, thanks for looking into the problem for me. At least I know I'm not doing something wrong.

     

    For what it's worth, I'm using the Mac version of Dreamweaver.

     

    Also, I wasn't getting this error message when I was using DW5. It started when I upgraded to 5.5.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 7, 2012 6:14 AM   in reply to MurraySummers

    Murray,

    Have you reported the bug and gotten feedback. The problem still occurs. Tks

    Yvan

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 7, 2012 12:34 PM   in reply to yvandaneault

    Undoubtedly, Murray has reported it.

     

    However, there's unlikely to be a fix issued for DW CS5.5.

     

    Even if they have identified it and fixed it, Adobe's track record is to include fixes like this in the next version of DW, due sometime this year.

     
    |
    Mark as:
  • Currently Being Moderated
    Jan 24, 2013 9:43 AM   in reply to John Waller

    Same problem in Dreamweaver CS6. But the solution that gave MurraySummers works for me. Delete the <title></title> and Undo. Pretty annoying.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 28, 2013 7:16 AM   in reply to MysticKnight

    i got the same problem, it just occurs because theirs a rollover i think, cause when i want a page without rollover buttons inserted, it doesn't occur.

    It's a very anoying problem, because i'm just learning with Cs6 and i followed steps on the tutorials and now i had a delay for 3 weeks because i was figuring how and why and what i did wrong, but......i didn't do anything wrong (thanks to this post i finaly know) so i'm curious if their would be an update for the program to fix it without having to buy a new version. i just bought mine a month ago!!!!!

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 30, 2013 11:55 AM   in reply to alessio_92

    The easiest way to resolve this for me has been to externalize your javascript in the template file.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points