473,657 Members | 2,479 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 1885
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
4448
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
1552
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
2100
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
1973
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
2199
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
9306
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
5578
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
3657
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
4
1377
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
8844
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8742
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...
0
8621
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7354
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6177
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5643
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
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1971
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.