[thelist] document.write and XHTML strangeness

Tom Dell'Aringa pixelmech at yahoo.com
Mon Aug 19 14:27:01 CDT 2002


Heres an interesting question. The application I work on uses all
kinds of crazy JS functions to build things. They don't want you
writing any code on your own, trying to keep things consistent (I
don't agree with this, just statin' the facts.)

For example, we might use an init function with this line:

var field1 = new Field('Name', 'fieldname', 'val_alpha', FIELD_TEXT,
FIELD_REQ_NONE, 40, true, 'sumtin',new Array('test', 'test2',
'test3')  );

Then, js ends up writing out this field at runtime. We even do this
for tables! (gag).

Anyway, what you get is really no page code, just all javascript. You
view source and see no HTML (or XHTML for that matter) at all.

Now, if I try and validate this page, it validates! All it has is
some extenal JS files, and a couple of function calls in the body
(assume they are within CDATA blocks.) Yet the code that it REALLY
wrote out is horrible.

The real question is, how could you re-use that code? If I want to
parse it to a hand held with an XML parser - I can't right?

Now is it me - or is this a really assinine way of coding, and have
you ever heard of this before? I mean we even do stuff like this:

tmpTable = new Table ('tmpTable', -1,-1,-1,-1,1,0,0);
tmpTable.setColumnAlignment("center");
tmpTable.addColumn ( new Column (TABLE_COL_HTML , "View", 80, true,
true ));
tmpTable.addColumn ( col1 = new Column (TABLE_COL_HTML , "Name", 250,
true, true ));
tmpTable.addColumn ( new Column (TABLE_COL_HTML , 'History', 100,
true, true ));
tmpTable.addColumn ( new Column (TABLE_COL_HTML , 'Log', 100, true,
true ));
col1.setAlignment("left");
tmpTable.generateHeader();

(FYI, So far, all I write is code for new stuff, so I get to code on
my own! phew..)

Tom

=====
var me = tom.pixelmech.webDeveloper();

http://www.pixelmech.com/
http://www.maccaws.com/
[Making A Commercial Case for Adopting Web Standards]

__________________________________________________
Do You Yahoo!?
HotJobs - Search Thousands of New Jobs
http://www.hotjobs.com



More information about the thelist mailing list