Having trouble with xhtml compatibility

D

Don Lancaster

I have a very exotic but older JavaScript calculator at
http://www.tinaja.com/demo28a.asp

I cannot seem to get it to work under an xhtml revalidation.

The present xhtml code is http://www.tinaja.com/mcdev01a.asp
It returns "ch05 not defined" and similar errors to the console.

The present updated code with a substituted html header seems to work
just like the original as http://www.tinaja.com/mcdev01az.asp

I did move the JavaScript to http://www.tinaja.com/demo28a.js as an
external file to eliminate CDATA hassles. I did add the necessary
addition of id="..." to all the names and made the input commands
self terminating.

There are a very few remaining xhtml validation errors, but most of
these do not seem relevant.

What am I doing wrong?

--
Many thanks,

Don Lancaster voice phone: (928)428-4073
Synergetics 3860 West First Street Box 809 Thatcher, AZ 85552
rss: http://www.tinaja.com/whtnu.xml email: (e-mail address removed)

Please visit my GURU's LAIR web site at http://www.tinaja.com
 
R

RobG

I have a very exotic but older JavaScript calculator athttp://www.tinaja.com/demo28a.asp

I cannot seem to get it to work under an xhtml revalidation.

The document is being served as text/html, the XHTML DOCTYPE is doing
nothing useful so consider using HTML 4.01 instead.

The present xhtml code ishttp://www.tinaja.com/mcdev01a.asp
It returns "ch05 not defined" and similar errors to the console.

I guess you are using some browser other than IE. The error is caused
by:

function prepDisplay ( unrejHarm1, unrejHarm2, repDist, form ) {
cfh05.bgColor="#CCFFFF" ; // reset any older highlights
cfh07.bgColor="#CCFFFF" ;
...


Where "cfh05", "cfh07", etc. are ids of a TD elements. Accessing
elements by their unqualified id is a trick invented by IE and not
part of any standard. While it is considered a bad idea, many browsers
implemented it to be compatible with code written for IE. But now that
standards are starting to be better supported, newer browsers only
support it under certain circumstances.

Also, the bgcolor attribute is deprecated in HTML 4, so better to use
the DOM style object and backgroundColor property instead.

You can fix the issue by changing the line above (and all similar
lines) to:

document.getElementById('cfh05').style.backgroundColor = "#CCFFFF";


But since there are about 60 TDs to modify, it would be better to give
them all a class and modify that.

The present updated code with a substituted html header seems to work
just like the original ashttp://www.tinaja.com/mcdev01az.asp

That page has an HTML 3.2 DOCTYPE, it trips some browsers into
"support IE quirks" mode so the page "works" for those browsrs that
support IE's id idiosyncracy.

I did move the JavaScript tohttp://www.tinaja.com/demo28a.jsas an
external file to eliminate CDATA hassles. I did add the necessary
addition of id="..." to all the names and made the input commands
self terminating.

If by self terminating input commands you mean you used:

<input .... />

for input tags, that is irrelevant: the document is being served as
HTML so the slashes are just treated as junk in the file.

There are a very few remaining xhtml validation errors, but most of
these do not seem relevant.

XHTML errors are likely to be irrelevant when the document is served
as HTML. Change to an HTML DOCTYPE.
 
T

Thomas 'PointedEars' Lahn

Don said:
I have a very exotic but older JavaScript calculator at
http://www.tinaja.com/demo28a.asp

I cannot seem to get it to work under an xhtml revalidation.

A *what*? And why would you want or need to use XHTML -- because it's
"cool"?
The present xhtml code is http://www.tinaja.com/mcdev01a.asp
It returns "ch05 not defined" and similar errors to the console.

As Rob indicated, this is due to proprietary referencing and not due to
using XHTML. XHTML could only have revealed the previously existing
problem. And in your case it is probably a matter of the user agent instead
of XHTML because you serve your markup as text/html (so an XML parser and
its XML DOM is not likely to be triggered).
The present updated code with a substituted html header seems to work
just like the original as http://www.tinaja.com/mcdev01az.asp

I did move the JavaScript to http://www.tinaja.com/demo28a.js

All 404-compliant.
as an external file to eliminate CDATA hassles.

There are no hassles:

<script type="text/javascript">
// <![CDATA[

...

// ]]>
I did add the necessary
addition of id="..." to all the names and made the input commands
self terminating.

There are a very few remaining xhtml validation errors, but most of
these do not seem relevant.

You need to fix *all* Validation errors.
What am I doing wrong?

Using XHTML? Serving *XHTML* as text/*html*?


PointedEars
 

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,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top