Re: JavaScript in table tags

by "Hilma" <Hilma(at)hilma.freeserve.co.uk>

 Date:  Mon, 1 Apr 2002 18:15:02 +0100
 To:  "Martin Clifford" <MLC1(at)nrc.gov>,
<hwg-basics(at)hwg.org>
 References:  nrc
  todo: View Thread, Original
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="Prices Chart"
          border ="1"
          class="TextFont"
          width ="50"
          align="left">


         <script type="text/javascript" language="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=fromQty; halfKilo<=toQty; halfKilo=halfKilo+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: hwg-basics mailing list archives, maintained by Webmasters @ IWA