using javascript in .xhtml file

J

James Black

I am trying to combine using MathML and javascript in the same page,
running under Firefox 1.5.

I needed to have it called index.xhtml, as it seems to make a
difference for the MathML part, but, when I do this, scriptaculous is
not available.

Here is what I do for the beginning of my document, and I am curious
what I need to do to get this to work.

Thank you.

<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
"http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
<!ENTITY mathml "http://www.w3.org/1998/Math/MathML">]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"
/>
<script type="text/javascript" src="prototype.js"></script>
<script src="scriptaculous.js" type="text/javascript"></script>
 
D

David Dorward

James said:
I needed to have it called index.xhtml, as it seems to make a
difference for the MathML part

On the WWW the filename is irrelevent, you need to send the document with an
application/xhtml+xml content-type (although most servers will send that
content type for files with a .xhtml extension).
, but, when I do this, scriptaculous is not available.

There are a number of differences with JavaScript support in XHTML
documents, they are described in the Mozilla XHTML FAQ:

http://www.mozilla.org/docs/web-developer/faq.html#xhtmldiff

I would expect one of these to be the cause of your problem, but I don't
know my way around the internals of scriptaculous and prototype.
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"
/>

This should not appear in XHTML documents served as application/xhtml+xml.
http://www.w3.org/TR/xhtml1/#C_9
 
T

Thomas 'PointedEars' Lahn

David said:
This should not appear in XHTML documents served as application/xhtml+xml.
http://www.w3.org/TR/xhtml1/#C_9

If you read anything in C.9 as SHOULD NOT (recommendation against), you need
(new) glasses. It states:

| In order to portably present documents with specific character encodings,
| the best approach is to ensure that the web server provides the correct
| headers. If this is not possible, a document that wants to set its
| character encoding explicitly must include both the XML declaration an
^^^^
| encoding declaration and a meta http-equiv statement (e.g., <meta
| http-equiv="Content-type" content="text/html; charset=EUC-JP" />).


PointedEars
 
J

James Black

David said:
I would expect one of these to be the cause of your problem, but I don't
know my way around the internals of scriptaculous and prototype.

The scriptaculous problem was that it uses document.write, so I
changed that, and got it working.
 
D

David Dorward

Thomas said:
If you read anything in C.9 as SHOULD NOT (recommendation against), you
need (new) glasses.

Drat, I missed that. Blame it a combination of being incredibly frustrated
with the specs indecision and buck passing when it comes to Appendix C and
the assumption that writing an XHTML with the intention of never serving it
as anything but text/html as being stupid.

If a document is to be served as multiple media types, the HTTP server
must be used to set the encoding of the document.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top