Newsgroups: alt.html
From: "Jukka K. Korpela" <jkorp...@cs.tut.fi>
Date: Wed, 12 Jan 2011 09:35:57 +0200
Local: Wed, Jan 12 2011 2:35 am
Subject: Re: Table containing Javascript to build cells
P E Schoen wrote: Such things are usually better done with server-side scripting than with > I have a table which is filled with name, title, email, and phone > numbers. To make it easier to maintain I create a script which adds > the rows and items from an array. client-side JavaScript. > </tr> You have placed the <script> element between the </tr> and </tbody> tags. > <script language="JavaScript" src="contacts.js" > type="text/javascript"> </script> > </tbody> > </table> That's not allowed, since it would make the <script> a child of <tbody>, and a <tbody> cannot have any other children but <tr> elements. Usually you could either move the <script> element at the end of the last But, again, depending on scripting logic, you might need to do something > The script is: As an aside, the address is wrong, since the domain .null does not currently > var contact = new Array(); > contact[0] = ["Name0", "Title0", "mailto:ema...@null.null", exist. To indicate that an address-looking construct is just a dummy example, use the .example or .example.com pseudo-domain. To use an address-looking construct that detectable as invalid (e.g. for use as an initial value that is expected to be overridden), use the .invalid pseudo-domain. > document.write( "<tr><td ><p><b>" + contact[i][0] + Here we go... using document.write() makes the <script> non-movable - this is one of the many reasons for avoiding document.write(). With the current logic, there's not much to be done except accept A better logic would be to create the new elements using createElement() and > I can probably construct the entire table with the script. Certainly. And this would another way to fix the problem. > I did not It's not there, because the recommendation specifies what the allowed > see any information about script not allowed within a table. I > referred to http://www.w3.org/TR/html4/interact/scripts.html content of an element is, and such rules only implicitly defined the allowed contexts of an element (i.e. where an element may appear). The www.htmlhelp.com site contains a nice HTML 4 reference where the context rules have been explicitly written out, see e.g. http://www.htmlhelp.com/reference/html40/special/script.html -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||