473,732 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript failing xhtml [xhtml newbe]

Hi,

<script language="javas cript" type="text/javascript">
if(navigator.ap pName.indexOf(" Netscape") != -1){
document.writel n('<link rel="stylesheet " href="~styles/aquarelle_ns.cs s"
type="text/css" media="screen" title="base" />');
}else{
document.write( '<link rel="stylesheet " href="~styles/aquarelle.css"
type="text/css" media="screen" title="base" />');
}
</script>

<style type="text/css">
....
</style>
</head>
------------------------------------
Error Line 39 column 118: document type does not allow element "link" here.
....xt/css" media="screen" title="base" />');The element named above was
found in a context where it is not allowed. This could mean that you have
incorrectly nested elements -- such as a "style" element in the "body"
section instead of inside "head" -- or two elements that overlap (which is
not allowed).

One common cause for this error is the use of XHTML syntax in HTML
documents. Due to HTML's rules of implicitly closed elements, this error can
create cascading effects. For instance, using XHTML's "self-closing" tags
for "meta" and "link" in the "head" section of a HTML document may cause the
parser to infer the end of the "head" section and the beginning of the
"body" section (where "link" and "meta" are not allowed; hence the reported
error).

What can I do?
NB: The html form of it
http://www.jeanpierredaviau.com/aquarelle.html

--

X trÍme newbe
.......
masm32
windows Xp
asus p4 s533/333/133
Intel(R) Celeron (R) CPU 2.00 GHz
Aug 9 '05 #1
7 1888
Jean Pierre Daviau wrote:
[ inside a <script> ]
Error Line 39 column 118: document type does not allow element "link"
here. ...xt/css" media="screen" title="base" />');


http://www.w3.org/TR/xhtml1/#h-4.8
http://www.hixie.ch/advocacy/xhtml

--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Aug 9 '05 #2
Jean Pierre Daviau wrote:
Hi,

<script language="javas cript" type="text/javascript">
if(navigator.ap pName.indexOf(" Netscape") != -1){
document.writel n('<link rel="stylesheet " href="~styles/aquarelle_ns.cs s"
type="text/css" media="screen" title="base" />');
}else{
document.write( '<link rel="stylesheet " href="~styles/aquarelle.css"
type="text/css" media="screen" title="base" />');
}
</script>

<style type="text/css">
...
</style>
</head>
------------------------------------
[snip]


The most important issue: document.writel n() does not work in XHTML, if it's
served as application/xhtml+xml. I assume that you are going to do this (at
least with content negotiation, for browsers that support it), because
XHTML is just another form of tagsoup, if served as text/html.

Script snippets that contain '<' or '&' characters must be enclosed in
<[CDATA[ .. ]]> marked sections, otherwise the validator will not parse the
document as you intend it to do (browsers are more tolerant, but I would
not count on it).

This does not happen, if you stick to HTML, because the STYLE element has
the content model CDATA, which means that the parser ignores (e.g. does not
interpret a '<' as the start of a tag) everything until it finds the first
'</' followed by a character 'a..z' or 'A..Z'.

--
Benjamin Niemann
Email: pink at odahoda dot de
WWW: http://www.odahoda.de/
Aug 9 '05 #3

| http://www.w3.org/TR/xhtml1/#h-4.8
| http://www.hixie.ch/advocacy/xhtml
How come this page validate sending
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
It does not use the crazy CDAT[[]]?
http://www.kgreene.com/world.php
Aug 13 '05 #4
Jean Pierre Daviau wrote:
How come this page validate sending
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
It does not use the crazy CDAT[[]]?


(a) That meta tag is mostly rubbish and the real http header will trump it
every time

(b) Validation checks conformance to the DTD. That is entirely independent
of the content type.

(c) You said it didn't validate!

--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Aug 16 '05 #5
(c) You said it didn't validate!

Dont misunderstand me, I am just trying to figure out :-)

I did not express myself well.

I was talking about mypage http://www.jeanpierredaviau.com/echangeTidy.html

not this one:
http://www.kgreene.com/world.php

............... ......
exerp:
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head>
<title>kgreene. com :: World boundaries plotter project.</title>
<script type="text/Javascript" src="map.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
............... ...
Does not it send text/html content? It is suppose to be useless has I red
in the article you refered me.

======
If you use XHTML, you should deliver it with the application/xhtml+xml
MIME type. If you do not do so, you should use HTML4 instead of XHTML.
The alternative, using XHTML but delivering it as text/html, causes
numerous problems that are outlined below.
==============
My question is: is xhtml possible?
Aug 16 '05 #6
Jean Pierre Daviau wrote:

Does not it send text/html content?
Yes, but that has nothing to do with the <meta> tag you put in it.
It is suppose to be useless has I red in the article you refered me.
Sending XHTML as text/html gives you none of the benefits of XHTML (which
are of use to only a very small proportion of authors today anyway), and is
actively harmful in those (admittedly small proportion of) browsers which
implement HTML correctly.
My question is: is xhtml possible?


In 2005 it is mostly pointless and rather impractical.

--
David Dorward <http://blog.dorward.me .uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Aug 16 '05 #7
In 2005 it is mostly pointless and rather impractical.


I beleive you :-)

Thanks
Aug 16 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4455
by: Sergio del Amo | last post by:
Hi, I post here because, i think that my problem can happen to a lot of people using javascript with xml and xsl and the future feedback can be useful to all of us. I hava an xml file with a tree structure and a xsl file to transform it into xhtml strict. In my file xsl i have: <head> <title>Generic XHTML Treeview</title> <meta http-equiv="Content-type" content="text/html;
12
1565
by: Tom | last post by:
Hi all, I am a newbe to javascript so I could use your help. I checked the FAQs and searched google but I could not resolve this problem. My form is as follows: <form action="serversidehandlerurl.php" method="post" onsubmit="if(document.getelementbyid) { window.open(document.getelementbyid('pblinks').selectedindex.value); return false; }" > <select id="pblinks" size="1" > <option selected="selected" >Select the size...</option>...
10
2107
by: Rob Fentress | last post by:
I am trying to develop very standards-compliant content using XHTML and CSS. I am using CSS positioning and thus need to only include my stylesheet on browsers I have tested to make sure they display correctly. The page is readable without the CSS though the formatting is not pretty, but browsers like Netscape 4.x bungle the positioning if I include the stylesheet, making it unreadable. I am using the JavaScript Browser Sniffer by Eric...
7
1982
by: Trvl Orm | last post by:
I am working with 2 frames, Left and Right and the main code is in the left frame, which has been attached. Can someone please help me with this code. I am new to JavaScript and can't figure it out. What needs to happen is this: On the left frame you should have a series of buttons, which when pushed makes things happen on the right frame.
4
2200
by: Keith | last post by:
Hi, I'm in the process of learning a bit of web programming, and I'm making an effort to stay compliant with current web standards. I have a minimal web page with divs intended to change colour when the mouse rolls over them, but despite the fact that the page validates as XHTML, it doesn't work in either IE6 or Firefox. Am I making an obvious mistake? The HTML file is as follows:
136
9429
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
6
5581
by: ged | last post by:
Hi, i am a oo (c#) programmer, and have not used javascript for a while and i cant work out how javascript manages its references. Object References work for simple stuff, but once i have an object collection and stanrd using it it starts to fall apart. Clearly there is something about javascript's usage of passing "By ref" that i am not getting. i have had a look on the web and found some examples, but i cant see why my code does not...
8
3674
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
4
1380
by: jk | last post by:
Newbe here :) I am trying to get a pixmap to appear in my KDE system tray like knotes, akregator etc. Cutting out a lot of code the key lines are ... QPixmap mPixmap; .... mPixmap = KSystemTray::loadIcon("/usr/share/icons/hicolor/16x16/apps/ konserve.png"); setPixmap(mPixmap);
0
8944
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8772
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9303
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9233
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6030
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4803
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3258
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2714
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2176
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.