Solved

W3C validation of javascript in HTML 4.01 Frameset

Posted on 2014-04-05
14
457 Views
Last Modified: 2014-04-07
I have a page with DOCTYPE 4.01 Frameset, and would like it to validate with W3C.  The code parser objects so some javascript on the page:
 
Line 12, Column 119: delimiter "'" invalid: only S separators and TAGC allowed here … src="data/rezdata.js?'+Math.random()+'" type="text/javascript"></sc'+'ript>');

Error Line 12, Column 119: end tag for element "SC" which is not open
… src="data/rezdata.js?'+Math.random()+'" type="text/javascript"></sc'+'ript>');

I wonder if there is an equivalent of CData which can be used to shield these lines from the code parser?  Here is the code which causes the errors:

<script type="text/javascript">
document.writeln('<sc'+'ript language="JavaScript" src="data/rezdata.js?'+Math.random()+'" type="text/javascript"></sc'+'ript>');
</script>
0
Comment
Question by:ddantes
  • 4
  • 4
  • 3
  • +1
14 Comments
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39980704
Why is the closing </script> split up like this </sc'+'ript>'?
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39980731
The opening <script> tag is too.
0
 

Author Comment

by:ddantes
ID: 39980753
I'm embarrassed to admit, I have no idea.  I'm guessing  it is some kind of escape which frameset requires.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39980798
Not that I know of.
0
 

Author Comment

by:ddantes
ID: 39980830
I tried re-writing that line of code, without the interruptions in the word "script".
The page no longer worked.  It is a frameset parent, and it did not load the child content.
0
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 100 total points
ID: 39980899
I rewrote it several ways.  Splitting up the string did clear one error but I could not get the javascript that it loaded to run.  If your page works in all the browsers, then you'll have to ignore that 'error'.
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.

 

Author Comment

by:ddantes
ID: 39980937
Thank you for your testing.
0
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 300 total points
ID: 39980953
The validator triggers on: </

It sees an html end tag which is invalid because of the broken up string.

The validator refers to this page for a generic explanation and solution: http://www.htmlhelp.com/tools/validator/problems.html#script

So basically just precede a slash in this situation with a backslash so it won't be recognised as an html end tag.

Breaking up script tags is usually not necessary anymore. I've used stuff like this in the past to stop browsers or even editors from parsing strings like that as actual html tags and mess up rendering or formatting.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39980983
Firefox didn't like it without the split.
0
 
LVL 35

Expert Comment

by:Robert Schutt
ID: 39981073
How strange, maybe it's a combination of problems?

I've tested in Firefox with just an alert in the included .js and it worked fine:
capture FireBugunless I missed something in my setup I feel that would be a better solution because it also validates: http://validator.w3.org/check?uri=http%3A%2F%2Fschutt.nl%2Fee%2FQ_28405988%2Findex2.htm

But of course if there is a reason to split the script tags then that's fine but still, using the backslash, accepting the validation error is not necessary.
0
 
LVL 52

Expert Comment

by:Scott Fell, EE MVE
ID: 39981088
Dave or Robert, any insight on his other question about why framesets are causing issues on Expression Web. I'm out of ideas.  http://www.experts-exchange.com/Web_Development/WebApplications/Q_28405995.html
0
 

Author Comment

by:ddantes
ID: 39981391
Robert:  Thank you, your solution worked.  The pages perform their function and the code validates.  I've requested attention to reopen the question for awarding points.
0
 
LVL 35

Expert Comment

by:Robert Schutt
ID: 39981473
Great, thanks.
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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

867 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

21 Experts available now in Live!

Get 1:1 Help Now