I have some markup like the following:
<form>
<table>
<script>
<!-- Write the table markup //-->
</script>
</table>
<form>
The script draws the guts of the table as it is being rendered. This
works just fine, except that HTML 4.01 strict (to which I'd like to
conform) requires <script> tags to be children of either <head> or
<body>. I'd like to find a good way to get the <script> where the
standard wants it. My first idea is to draw the table with script
using innerHTML after the table has rendered, but the table in
question is decently sized, which makes me suspect that a browser
would have some performance issues with rendering it after the fact.
Is there a better way to accomplish what I want?
--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome. 6 1740
On Fri, 1 Oct 2004 19:42:35 +0000 (UTC), Christopher Benson-Manica
<at***@nospam.cyberspace.org> wrote:
[snip] The script draws the guts of the table as it is being rendered.
I'll assume that using server-side scripting is not an option.
This works just fine, except that HTML 4.01 strict (to which I'd like to conform) requires <script> tags to be children of either <head> or <body>.
That's not quite true. SCRIPT elements can be placed in the HEAD element,
and anywhere else that accepts "special" or "inline" elements. That
includes many places, but it does not include SCRIPTs as direct children
of TABLEs. In fact, only a few elements can be direct children of any
TABLE element.
[snip]
Is there a better way to accomplish what I want?
Well, what precisely do you want? Are you writing the entire table, or
just a subsection of it? If it's the latter, are we talking an entire
table section, a couple of rows, or just one or two cells?
If you're writing the entire table, write the TABLE tags with the script,
too. If it is just a few parts, it would be best to add them after the
table has been rendered.
By the way, you can only write to the innerHTML property of TD elements.
All other table components (expect CAPTION) are read-only. However, you
can use the W3C DOM to add, remove and modify table sections and rows.
Mike
--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Michael Winter <M.******@blueyonder.co.invalid> spoke thus: I'll assume that using server-side scripting is not an option.
Correct.
That's not quite true. SCRIPT elements can be placed in the HEAD element, and anywhere else that accepts "special" or "inline" elements. That includes many places, but it does not include SCRIPTs as direct children of TABLEs. In fact, only a few elements can be direct children of any TABLE element.
The W3C site http://www.w3.org/TR/html4/interact/....html#h-18.2.1
suggests, at least to me, that <head> and <body> are the only
permissible parents of <script>.
Well, what precisely do you want? Are you writing the entire table, or just a subsection of it? If it's the latter, are we talking an entire table section, a couple of rows, or just one or two cells?
It's the entire table, a typical size of which is 6 rows by 10
columns. It seems to my uneducated thinking that that's a significant
amount of work for a browser to insert using innerHTML.
If you're writing the entire table, write the TABLE tags with the script, too. If it is just a few parts, it would be best to add them after the table has been rendered.
Well, currently I *am* writing the table with script, but if my
interpretation of the information I linked to above is correct, I
won't be able to do so and conform to the HTML 4.01 standard.
By the way, you can only write to the innerHTML property of TD elements. All other table components (expect CAPTION) are read-only. However, you can use the W3C DOM to add, remove and modify table sections and rows.
But I could insert an entire table in a <td>, correct? It does happen
that in the real markup the table in question is the child of a <td>
element. Perhaps that option is at least possible...
--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Christopher Benson-Manica wrote: The W3C site http://www.w3.org/TR/html4/interact/....html#h-18.2.1 suggests, at least to me, that <head> and <body> are the only permissible parents of <script>.
"in" means "descendent of" not "child of"
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
On Fri, 1 Oct 2004 20:05:08 +0000 (UTC), Christopher Benson-Manica
<at***@nospam.cyberspace.org> wrote:
[snip] The W3C site http://www.w3.org/TR/html4/interact/....html#h-18.2.1 suggests, at least to me, that <head> and <body> are the only permissible parents of <script>.
True, the text of the specification states that SCRIPT elements may appear
in the HEAD and BODY elements, but it doesn't say that is the only
location. The DTD is more specific:
<!ENTITY % special
"A | IMG | OBJECT | BR | SCRIPT | MAP | Q | SUB | SUP | SPAN | BDO">
marks the SCRIPT element as a special entity, which in turn,
<!ENTITY % inline
"#PCDATA | %fontstyle; | %phrase; | %special; | %formctrl;">
is an inline element.
<!ELEMENT HEAD O O (%head.content;) +(%head.misc;)>
and
<!ENTITY % head.misc "SCRIPT|STYLE|META|LINK|OBJECT">
declare that the SCRIPT element may occur in the HEAD element any number
of times.
Furthermore,
<!ELEMENT BODY O O (%block;|SCRIPT)+ +(INS|DEL)>
makes a special exception for SCRIPT, which unlike other inline elements,
may appear as a direct child of the BODY element.
So far, this agrees with your assessment, but:
<!ELEMENT P - O (%inline;)*>
and
<!ELEMENT A - - (%inline;)* -(A)>
do not. Here, both P and A elements state that they may contain any inline
elements. If SCRIPTs were disallowed, a similar entry would occur like
"-(A)" to explicitly disallow them. The vast majority of non-empty
elements are the same. The only exceptions are elements like lists,
tables, SELECTs, and similar that define precisely what they can contain.
I hope that's a clear enough case. :)
It's the entire table, a typical size of which is 6 rows by 10 columns. It seems to my uneducated thinking that that's a significant amount of work for a browser to insert using innerHTML.
I don't think so. Richard Cornford (<URL:http://www.litotes.demon.co.uk/>)
has written a table sorter that obviously requires the movement of
potentially all the rows in a table. His demo initially uses 200 rows and
the operation occurs very quickly. What you're proposing isn't that taxing
for modern processors. Can't say I know when performance would suffer,
though.
[snip]
Well, currently I *am* writing the table with script, but if my interpretation of the information I linked to above is correct, I won't be able to do so and conform to the HTML 4.01 standard.
You can, but the SCRIPT element must be placed in an element that allows
inline elements. P, TD, DIV, and numerous others all qualify.
[snip]
But I could insert an entire table [using innerHTML] in a <td>, correct? It does happen that in the real markup the table in question is the child of a <td> element. Perhaps that option is at least possible...
You could. It would probably be more efficient than using the W3C DOM,
too, unless the rows were identical and you could just clone them.
Mike
--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
David Dorward <do*****@yahoo.com> spoke thus: "in" means "descendent of" not "child of"
Oh, now I see. So Michael's original suggestion was spot on. Thanks
to both of you.
--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
Michael Winter <M.******@blueyonder.co.invalid> spoke thus: I hope that's a clear enough case. :)
Yes, I did understand it... maybe next time I will look at the DTD
myself before making guesses. ;)
You could. It would probably be more efficient than using the W3C DOM, too, unless the rows were identical and you could just clone them.
Yes, now I see, and I have done so. Thank you.
--
Christopher Benson-Manica | I *should* know what I'm talking about - if I
ataru(at)cyberspace.org | don't, I need to know. Flames welcome. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: F. Da Costa |
last post by:
Following is a snippet of html in which I hide a whole table and try to
hide a single row.
Here is my question (plz don't chew my head off if its css related instead):
Why does the divTable...
|
by: Toby Austin |
last post by:
I'm trying to replace <table>s with <div>s as much as possible.
However, I can't figure out how to do the following…
<table>
<tr>
<td valign="top" width="100%">some data that will...
|
by: Greg N. |
last post by:
Hi folks,
I have a table cell with a background image, something like
<td background=landscape.jpg height=200></td>
The sole purpose of this code is to display the image inside that table...
|
by: Xah Lee |
last post by:
Jargons of Info Tech industry
(A Love of Jargons)
Xah Lee, 2002 Feb
People in the computing field like to spur the use of spurious jargons.
The less educated they are, the more they like...
|
by: Eric Lindsay |
last post by:
Is learning to write CSS a better use of time than finding and using a
package that produces complete web pages?
I've moved to a new platform (Macintosh), taking with me about 400
personal web...
|
by: Giggle Girl |
last post by:
Can someone show me how to insert a row at any given row index of an
already created table? It only has to work in IE6 (used on intranet at
work).
Specifically, if a table is 20 rows in total...
|
by: King Albert |
last post by:
Why does the 'insertrow' work in this situation:
<html>
<script type="text/javascript">
function addRow(tableID) {
var tableRef = document.getElementById(tableID);
var newRow =...
|
by: Romulo NF |
last post by:
Greetings again to everyone,
Im back to show this grid componenet i´ve developed. With this grid you can show the data like a normal table, remove the rows that you need, add rows, import data,...
|
by: oldyork90 |
last post by:
Is there a way I can time browser drawing/rendering time for a given
element. I have a huge table. I have it's name. We'd like to
experiment with different combinations to speed things along. ...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM)
Please note that the UK and Europe revert to winter time on...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |