Re: JavaScript in table tags
by "Martin Clifford" <MLC1(at)nrc.gov>
|
Date: |
Mon, 01 Apr 2002 13:02:23 -0500 |
To: |
<Hilma(at)hilma.freeserve.co.uk>, <hwg-basics(at)hwg.org> |
|
todo: View
Thread,
Original
|
|
Okay -
>From what I understand, the W3C put together a list of *recommendations* =
for people to follow as they write their code. I don't believe you must =
strictly adhere to it as law.
Frankly, there is no way you are going to get those values into your =
content section without using JavaScript (unless you are going to use =
server-side applications to do so) without putting <script/script> tags =
into the table. I can't see WHY they would recommend that developers not =
use JavaScript commands within a table... I do it on my site with no =
problems.
Maybe I'll head on over to the W3C website and see what it's all about.
Martin
>>> "Hilma" <Hilma(at)hilma.freeserve.co.uk> 04/01/02 12:15PM >>>
Hi -
>While I could not connect to your site for whatever reasons, I can
visualize the layout of your page quite easily. And you >are right, it is
the standard format (from what I've seen).
!! oh dear - i'm having real problems with people accessing my sites :-(
I C&P the address that i see in my browser, but others can;t get at them.
Strange :-(
>I'm not quite sure I understand what you are trying to accomplish with
JavaScript, or why it would give you an error. >JavaScript can be placed
anywhere in an HTML document and still function, unless you are trying to
use event handlers >inside the Table tags themselves, in which case you =
get
errors because Tabel tags can't handle events.
I want to fill my tables with values that i calculate; so i have JS to add
the <td> and the values that it calculates.
>>Or are you just trying to strictly adhere to W3C standards, and in that
mind-set, it is an error to put JavaScript inside >>
>>Table tags? I might be able to help if you could just clarify a bit. =
:o)
That is it exactly - the code does exactly what i want it to do ( in the 3
big browsers) - but won't pass W3C validation, as no <script tags> are
allowed inside tables.
so whilst
----------------------------
<table
summary=3D"Prices Chart"
border =3D"1"
class=3D"TextFont"
width =3D"50"
align=3D"left">
<script type=3D"text/javascript" language=3D"javascript">
calcPrices(1,10)
</script>
</table>
(Which is within the content areas of the main page, ie within a <td> cell
defintion)
------------------------------------
function calcPrices(fromQty, toQty, meAlign)
{
document.write("<tr> <td>Weight</td> <td>Cost</td>");
for (halfKilo=3DfromQty; halfKilo<=3DtoQty; halfKilo=3DhalfKilo+1)
{
document.write("<tr><td>"+halfKilo/2+"</td><td>"
+(halfKilo*2.5)+"</td></tr>");
}
document.write("</r>")
}
----------------------------------------------
Works fine, it doesn't pass validation;
And whilst i could fix the code to create the whole *Prices* table within
CalcPrices, I can;t fix it to get the prices-calc script (which also =
creates
the Prices-table cells) out of the "Main content cell" of the page table.
>>I'll be here for a while... 8am to 5pm... everyday.
Would that be GMT, BST, US-time, Oz-time ...or when ?
or rather - where!
Lets go military and use GMT for everything :-)
Many thanks -
hilma
--x-----
HTML Guild: hwg-basics mailing list archives,
maintained by Web Professionals @ IWA