Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Why am I getting a syntax error on the </head> line in DW CC?

New Here ,
Aug 16, 2013 Aug 16, 2013

I am getting a syntax error in DW CC.  Other threads have indicated this was a bug in CS6 but had been fixed in CC.  That leads me to believe it's my fault, but I can't figure it out.  Can anyone help based on the information I've pasted below?  Thanks!

<!doctype html>

<!--[if lt IE 7]> <html class="ie6 oldie"> <![endif]-->

<!--[if IE 7]>    <html class="ie7 oldie"> <![endif]-->

<!--[if IE 8]>    <html class="ie8 oldie"> <![endif]-->

<!--[if gt IE 8]><!-->

<html class="">

<!--<![endif]-->

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Untitled Document</title>

<link href="boilerplate.css" rel="stylesheet" type="text/css">

<link href="style.css" rel="stylesheet" type="text/css">

<link href="jQueryAssets/jquery.ui.core.min.css" rel="stylesheet" type="text/css">

<link href="jQueryAssets/jquery.ui.theme.min.css" rel="stylesheet" type="text/css">

<link href="jQueryAssets/jquery.ui.accordion.min.css" rel="stylesheet" type="text/css">

<link href="jQueryAssets/jquery.ui.tabs.min.css" rel="stylesheet" type="text/css">

<!--

To learn more about the conditional comments around the html tags at the top of the file:

paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/

Do the following if you're using your customized build of modernizr (http://www.modernizr.com/):

* insert the link to your js here

* remove the link below to the html5shiv

* add the "no-js" class to the html tags at the top

* you can also remove the link to respond.min.js if you included the MQ Polyfill in your modernizr build

-->

<!--[if lt IE 9]>

<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>

<![endif]-->

<script src="respond.min.js"></script>

<script src="jQueryAssets/jquery-1.8.3.min.js" type="text/javascript"></script>

<script src="jQueryAssets/jquery-ui-1.9.2.accordion.custom.min.js" type="text/javascript"></script>

<script src="jQueryAssets/jquery-ui-1.9.2.tabs.custom.min.js" type="text/javascript"></script>

<!--The following script tag downloads a font from the Adobe Edge Web Fonts server for use within the web page. We recommend that you do not modify it.--><script>var __adobewebfontsappname__="dreamweaver"</script><script src="http://use.edgefonts.net/adamina:n4:default.js" type="text/javascript"></script>

</head>

<body>

<div class="gridContainer clearfix">

  <div id="div1" class="fluid">

    <header id="header" class="fluid">

      <p><img src="Images/Logos/insidejoplinlogo.png"  alt=""/></p>

    

        <nav id="mainnav" class="fluid"> <ul class="fluid fluidList mainnavlist"> <li class="fluid mainnavitem zeroMargin_desktop"><a href="Index2.html" title="Inside Joplin Home" target="_self">Home</a></li><li class="fluid mainnavitem"><a href="news.html">News</a></li><li class="fluid mainnavitem"><a href="entertainment.html">Entertainment</a></li><li class="fluid mainnavitem"><a href="announcements.html">Announcements</a></li><li class="fluid mainnavitem hide_mobile"><a href="galleries.html">Galleries</a></li><li class="fluid mainnavitem hide_mobile"><a href="aboutcontact.html">About/Contact</a></li>  </ul> </nav>

     

    </header>

    <article id="indexguts" class="fluid">    <article id="indexarticle" class="fluid">

     

      <h4 class="fluid articleH4 zeroMargin_mobile">Latest News</h4>

      <p> </p>

     <div id="Accordion1">

        <h3><a href="#">Section 1</a></h3>

        <div>

          <p>Content 1</p>

          </div>

        <h3><a href="#">Section 2</a></h3>

        <div>

          <p>Content 2</p>

          </div>

        <h3><a href="#">Section 3</a></h3>

        <div>

          <p>Content 3</p>

          </div>

      </div>

     

    </article><article id="article1" class="fluid">

     

      <h4 class="fluid articleH4 zeroMargin_mobile">Latest Entertainment</h4>

      <p> </p>

      <div id="Accordion2">

        <h3><a href="#">Section 1</a></h3>

        <div>

          <p>Content 1</p>

          </div>

        <h3><a href="#">Section 2</a></h3>

        <div>

          <p>Content 2</p>

          </div>

        <h3><a href="#">Section 3</a></h3>

        <div>

          <p>Content 3</p>

          </div>

      </div>

     

    </article><article id="article2" class="fluid"><h4 class="fluid articleH4 zeroMargin_mobile">Latest Announcements</h4>

    <p> </p>

      <div id="Tabs1">

        <ul>

          <li><a href="#tabs-1">Obituaries</a></li>

          <li><a href="#tabs-2">Weddings</a></li>

          <li><a href="#tabs-3">More</a></li>

          </ul>

        <div id="tabs-1">

          <p>Content 1</p>

          </div>

        <div id="tabs-2">

          <p>Content 2</p>

          </div>

        <div id="tabs-3">

          <p>Content 3</p>

          </div>

    </div>

     

    </article><article id="indexbotleft" class="fluid">This is the content for Layout Article Tag "indexbotleft"</article><article id="article3" class="fluid">This is the content for Layout Article Tag "indexbotleft"</article></article><aside id="mainsidebar" class="fluid">This is the content for Layout Aside Tag "mainsidebar"</aside><aside id="mainsidebar2" class="fluid">This is the content for Layout Aside Tag "mainsidebar2"</aside><article id="indexbotrot" class="fluid">This is the content for Layout Article Tag "indexbotrot"</article>

    <footer id="footer" class="fluid">

    <nav id="footernav" class="fluid">

     <ul id="footernavlist" class="fluid fluidList"> <li class="fluid footernavlistitem zeroMargin_mobile"><a href="Index2.html">Home</a></li><li class="fluid footernavlistitem hide_mobile"><a href="news.html">News</a></li>

      <li class="fluid footernavlistitem hide_mobile"><a href="entertainment.html">Entertainment</a></li>

      <li class="fluid footernavlistitem hide_mobile"><a href="announcements.html">Announcements</a></li>

      

      

       <li class="fluid footernavlistitem zeroMargin_desktop zeroMargin_mobile"><a href="galleries.html">Galleries</a></li>

       <li class="fluid footernavlistitem zeroMargin_mobile"><a href="aboutcontact.html">About Us</a></li> 

        <li class="fluid footernavlistitem zeroMargin_mobile"><a href="mailto:info@insidejoplin.com">Email</a></li> <li class="fluid footernavlistitem zeroMargin_mobile"><a href="www.facebook.com/insidejoplin" target="new">Facebook</a></li></ul> 

       </nav>

       <article id="footerarticle" class="fluid"><img src="Images/Logos/insidejoplinlogo.png"  alt=""/></article>

    </footer>

  </div>

</div>

+

<script type="text/javascript">

$(function() {

          $( "#Accordion1" ).accordion();

});

$(function() {

          $( "#Accordion2" ).accordion();

});

$(function() {

          $( "#Tabs1" ).tabs();

});

</script>

</body>

</html>

17.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 16, 2013 Aug 16, 2013

Hmm, nothing is highlighting for me, but I'm on an older version of DW, maybe it's less picky.

What happens if you ad a semi-colon right before the </script> tag in this line...

<script>var __adobewebfontsappname__="dreamweaver"</script>

Translate
Community Expert ,
Aug 16, 2013 Aug 16, 2013

You have quite a few errors in that code.

Run the validator here: http://validator.w3.org/ and clean it up. Your syntax error should clear up once the code errors are taken care of.

Nevermind, I had a copy/paste issue.

Where is the error displaying (line number)?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 16, 2013 Aug 16, 2013

Hello, Jon.

It's line 37.  </head>

Thank you.

Bride

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 16, 2013 Aug 16, 2013

Hmm, nothing is highlighting for me, but I'm on an older version of DW, maybe it's less picky.

What happens if you ad a semi-colon right before the </script> tag in this line...

<script>var __adobewebfontsappname__="dreamweaver"</script>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 16, 2013 Aug 16, 2013

Dear Jon,

The syntax error disappeared.  My gratitude is endless.  I hate to take up any more of your time, but I'd love to know why that worked. 

Sincerely,

Bride

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 16, 2013 Aug 16, 2013

Generally, in javascript, each statement is closed with a semi-colon but there are times where it's not necessary to use one and the script will still work.

I'm guessing DWCC was programmed without the exceptions.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 16, 2013 Aug 16, 2013

I don't know if this is the problem or not, but HTML5 doc types do not use the type attribute in scripts or styles tags.  Use <script>   instead of <script type="text/javascript">

Use <style> instead of <style type="text/css">.  This will make your code valid in HTML5.

Nancy O.

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 16, 2013 Aug 16, 2013

O', Nancy O!

It's so lovely to get help from a DW rock star.  Your time and efforts are appreciated greatly. 

If I may ask, why did CC use the <script type="text/javascript> and <style type="text/css"> for me?

Or, perhaps, this is something I did.  If so, I don't know what it was.  Is it because I used the Edge Font?

Humbly Yours,

Bride

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 16, 2013 Aug 16, 2013

I'm still using CS6 and it incorrectly inserts <script type> into HTML5 docs.   It's something I fix manually.

I don't know if CC is doing the same thing. If so, it should be reported as a bug.

Nancy O.

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 29, 2013 Sep 29, 2013

This is all very weird... I'm having the same problem but none of the fixes are working for me... 

1. Have tried Murray's fix of deleting the <title></title> tags in this thread:

http://forums.adobe.com/message/5641168#5641168

2. Have tried your fix of  deleting the:  type="text/javascript" from the opening <script> tag.

3. Have tried Jon's fix of the semi-colon before the closing </script> tag.

Nothing works except deleting the closing tag itself!

However, right now, it's crazy. The error is pointing to a blank line!

error01.png

And the message reads: "There is a syntax error on line 83. Code hinting....."

Most weird....

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 30, 2013 Sep 30, 2013

shunithD wrote:

This is all very weird... I'm having the same problem but none of the fixes are working for me... 

1. Have tried Murray's fix of deleting the <title></title> tags in this thread:

http://forums.adobe.com/message/5641168#5641168

2. Have tried your fix of  deleting the:  type="text/javascript" from the opening <script> tag.

3. Have tried Jon's fix of the semi-colon before the closing </script> tag.

Nothing works except deleting the closing tag itself!

However, right now, it's crazy. The error is pointing to a blank line!

error01.png

And the message reads: "There is a syntax error on line 83. Code hinting....."

Most weird....

Could you start a new thread on yours?

I'm guessing there is an error in your code, but would need to see more in order to help. Please start up a new thread with a link to your malfunctioning page and we can take a look.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 30, 2013 Sep 30, 2013

Hi Jon...

No error in my code... it's untouched after being automatically generated... the semicolon you see in line 82 was an attempt at your suggestion... I just happened take the screen shot then.

Generally, the error message points to the line on which the closing </script> tag resides.

I'm getting the problem virtually acrooss the board...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 30, 2013 Sep 30, 2013

I've found that DW's error message tends to point to the end of a script if there is an error almost anywhere within it. Without seeing the entire code, it's impossible to say what the problem may be, or even if there technically is a problem.

One way to fix it though, if you can't find an error, is to simply move the script to an external .js file, then reference that file in the <head> section.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 30, 2013 Sep 30, 2013

Jon...

This is/happens with script generated by DW itself! In this case, it's a basic Form check and, the problem is identical whether I use DW's own form check or Yaromat's.

All the above are in template generated pages. Must check if it also happens in a non-template generated page.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 30, 2013 Sep 30, 2013

Further...

Seems to happen only in template generated pages...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 30, 2013 Sep 30, 2013

Without seeing the actual file in question, as long as the file works correctly, I would suggest moving that script to an external .js file.

In your template, Copy everything between the <script> and </script> tags (but leave those actual tags behind).

Open a new Javascript file and Paste the information there

Save the javascript file to your site as a .js

In the original <script> tag in the Template, add a source attribute and path to the new .js file...

<script src="yourfile.js" type="text/javascript"></script>

Make sure the path to the file is correct in your template and the .js is functioning

Save and update Child pages

If DW still shows an error, there is a different problem in the file and it's simply getting confused and noting an error in the <script> when none exists there (not unheard of).

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Sep 30, 2013 Sep 30, 2013

Thanks for that Jon... yup have seen the suggestions about using external js files.

One point though... the errror seems to pop up in template generated child files in scripts added to the said child file in the editable region.

Doesn't seem to happen in the original template file... yup... just cross-checked.

Using a template file, the js goes into a non-editable region and there's no problem. Cutting it from there and pasting it in an editable region also shows no problem.

Also, pasting the js in the body of the child page doesn't bring up the error.

So, clearly, it's an issue with child pages and js added to an editable region between the head tags subsequently.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 01, 2013 Oct 01, 2013

As I've mentioned, a couple of times now, it's impossible to tell what may be going wrong without seeing your actual code. The behavior you describe does not happen in my versions of DW, which leads me to think it's not a bug within the program, but an actual error somewhere within your page that DW is simply marking in the wrong location (which happens pretty regularly).

I've played the missing apostrophe/semi-colon/quote marks game many, many times and a new set of eyes looking at your code may be the only thing needed to find the actual problem.

Don't simply trust that DW is going to ensure your code is error free. Many seemingly simple things can cause code errors in the program.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 01, 2013 Oct 01, 2013

Well Jon, the code is very simple... it's generated by DW's form check... and, as i said, it happens with unfailing regularity the minute it's put in to a template generated child.

This is what the code on the page looks like:

<head>

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

<title>Title Here</title>

<meta name="Keywords" content="some keywords here" />

<meta name="Description" content="Description here" />

<script type="text/javascript">

function MM_validateForm() { //v4.0

  if (document.getElementById){

    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;

    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args);

      if (val) { nm=val.name; if ((val=val.value)!="") {

        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');

          if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';

        } else if (test!='R') { num = parseFloat(val);

          if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';

          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');

            min=test.substring(8,p); max=test.substring(p+1);

            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';

      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }

    } if (errors) alert('The following error(s) occurred:\n'+errors);

    document.MM_returnValue = (errors == '');

} }

</script>

<!-- InstanceEndEditable -->

</head>

And, whammo: "There is a syntax error on line xx. Code hinting may not work until you fix this error."

And, the error always highlights the closing </script> line.

The script itself is fine:

1. If one puts it into an external js file, there's no problem

2. If one puts it in the body section, there's no problem

3. If one puts it in the template, there's no problem

Also, if one removes the closing </script> tag, the error goes away

The problem only happens in a child generated by a template and in the location I've illustrated. Apparently, this is a problem a lot of users are facing...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 01, 2013 Oct 01, 2013

The code snippet you pasted above does not help. We need to see the code of the entire page. DW regularly places error warnings in the wrong location. Your actual problem may not be anywhere near the <head> section and DW's alarm may only be going off because the javascript forces it to recognize an error albeit in the wrong location.

As a matter of fact, when I add the code above to a new blank document, I get no error at all.

Could you please post the entire code of your page with the problem, or better yet, a link to the problem page online?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 01, 2013 Oct 01, 2013

Jon...

If you paste it in a new blank document, as I have said, you will not get any error. But just try it on any page that is created from a template.

As I've said, It doesn't show up if the code is in the template itself. Nor if it's in the body section. It only appears in a child created by a template and in the javascript that gets created or pasted in the editable region of the <head></head> tags.

I've spelled this out in detail in my posts... and also linked to one other thread in Post #9. Here's the thread again:

http://forums.adobe.com/message/5641168#5641168

All in all, it appears to be a DW bug. Some people have found fixes; unfortunately, they don't seem to work for me. So I can either live with the problem and treat it as a cosmetic issue, or use an external js file as others, as well as yourself, have suggested. (At the moment I'm using an external js.)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 01, 2013 Oct 01, 2013

Your original post in this thread led me to believe the other solutions offered, in the thread you linked to, didn't work for you and that your problem was, perhaps, slightly different than the one being discussed there.

Maybe you were just hoping to submit a bug report and didn't actually want any help with your issue, per se?

The absolute best place to do that would be via the official Bug Report/Feature Request form. It's available here: https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

Good luck.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 01, 2013 Oct 01, 2013

Although you didn't provide any links to it, I see a problem with the code in your template & I suspect this is the source of your problems.  

#1 There is no ending region after the doctitle.

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

<title>Page Title</title>

<!-- TemplateEndEditable -->

#2 You must define an editable region for your <head> tags -- separate from the doctitle and it should look like this:

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

<!-- TemplateEndEditable -->

</head>

Make those Template changes.  Validate code, fix any errors. Save & populate changes to child pages.

Nancy O.

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Oct 01, 2013 Oct 01, 2013

Nancy,

It's an untouched template created by DW... all I did was mark the areas I wanted to be editable.

1. The <title></title>  is an editable region within the <head></head> tags. So, there's a non-editable region, within which is the non-editable opening <head> tag.

2. Then, as illustrated in the post above - #19 - is the editable title and meta area. The JS is placed by DW here, after the meta tags.

3. Then, there's the end / closing of the editable area. (Referring to your point 1. above, there is a closing <!--TemplateEndEditable--> tag after the js.)

4. Then comes some more non-editable 'head' content (linking to external style sheets, js files, mediaqueries, etc.). The closing </head> tag.  The opening <body> tag.... some more content (all of this is non-editable), until we have the next editable region which falls in the <body> region.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 02, 2013 Oct 02, 2013

A properly formed Template should look something like this:

<!doctype html>

<html>

<head>

<meta charset="utf-8">

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

<title>Untitled Document</title>

<!-- TemplateEndEditable -->

<!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js">

</script>

<link href="../Styles/main-styles.css" rel="stylesheet" type="text/css" media="all">

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

<!-- TemplateEndEditable -->

</head>

<body>

<div id="wrapper">

<header>

<h1>Site Name</h1>

<h2>Some pithy slogan</h2>

<nav><h3>Site wide menu</h3></nav>

</header>

<aside>

<h3>Left side bar...</h3>

<!-- TemplateBeginEditable name="AsideLeft" -->

<p>Editable Left side bar content goes here...</p>

<!-- TemplateEndEditable -->

</aside>

<article>

<!-- TemplateBeginEditable name="MainContent" -->

<h3>Editable main content goes here...</h3>

<!-- TemplateEndEditable -->

</article>

<aside>

<h3>Right side bar...</h3>

<!-- TemplateBeginEditable name="AsideRight" -->

<p>Editable Right side bar content goes here...</p>

<!-- TemplateEndEditable -->

</aside>

<footer>

<h3>Site wide footer</h3>

</footer>

<!--end wrapper--></div>

</body>

</html>

Nancy O.

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines