SageFix. LetsFix!  
Current Location : Home > Web Development > JavaScript > Javascript in HTML Tables Share/Save/Bookmark    

Main Menu
SageFix - Let's Fix

Board Categories
    Web Site Designing
- Graphics
    Web Development
- .NET
- Classic ASP
- JavaScript
- PHP
    WebSite Management
- Promotion Techniques
- Search Engine Optimization
    Databases
- MySQL

Tutorials

Database Connection Strings

  Contact Us


 1 - 12 of 12 [Total 1 Pages]  
Javascript in HTML Tables      Jul 23, 2002, 15:35 1
  
http://www.webreference.com/js/column2/format.html

I read on the above tutorial that one should NEVER place a script in an HTML table, especially if it has doument. write in it. Does anyone know why this would be true? I have a date and time script in my HTML table and have no problem with it. Your thoughts???

Block

 
      Jul 26, 2002, 20:20 2
  
Exactly! It's not just to make life easier for us - they benefit from a richer experience at the end of the day.

See another post in this forum for the whole W3C standards conformance shebang! (which I'm 100% behind incidentally, but I'm ultimately forced to target IE in the meantime....)

 
      Jul 27, 2002, 03:15 3
  
well as long as standards keep moving the way they are we should have no problem with the damn hassle of cross browsability, what with xhtml(strict) and xml should help people view correctly and not have any hassles with the engines that microsoft or netscape use.

 
      Jul 27, 2002, 03:47 4
  
OUCH @ trying to do anything constructive without
innerHTML. I use it often instead of passing
variables around

Flawless

 
      Jul 23, 2002, 15:56 5
  
I assume you are reffering to the last para:

Quote:
If you would like to display the date somewhere in an HTML table, you're in trouble. Never embed a script in a table, especially if it has a document.write() statement. At this time there is no workaround for this annoying bug (besides printing the entire table in JavaScript, or using Dynamic HTML).
I am not total sure of what they meant there.. but I put document.write in HTML table and nothings happends... I also use the VB version and still nothing happens... chnaces of somene's browser having problme (seems to me) is next to nothing.

When ever I want to put the current date and time I just simply use the document.wite and it works fine.. I dont know what that person is meant...


I am assuming they are referring to the JS code just above the para, I can see there is problem.. but what if that was put inside a function so we just make a call to the function and it prints out the date as it called.

I think the author has some reason for saying that, which should have been made clear but I dont agree with her/him.

 
      Jul 23, 2002, 19:40 6
  
the only thing that document.write would do is if you have it in a onclick event which would clear the screen, but as for that comment, it sounds kind of stupid unless, you put the script in the wrong place like outside a tr or td tag etc, which would simply treat it as a comment tag and print it at the top of the table or something like that.

And in anycase I would use
innerHTML/outerHTML/innerText/outerText
to modify the content if using an event to write to the document, unless you want a clean page of course

 
      Jul 23, 2002, 22:01 7
  
I think this had to do with an old NS3(?) bug with document.write()-ing inside a <td>...

 
      Jul 24, 2002, 01:56 8
  
I never use document.write - i think it's bad practice unless
you're creating a new window with only one line - and
even then i'd probably just create an object and use, as Andrew quite rightly said, innerHTML/innerText


Flawless

 
      Jul 24, 2002, 11:24 9
  
To be honest i aint one for cross browsability with netscape, but i thought innerHTML was a ie only feature. Then again i think flawless is like me with cross browsability.

 
      Jul 24, 2002, 11:49 10
  
Nope - innerHTML is universal - I believe.

Flawless

 
      Jul 26, 2002, 19:31 11
  
Quote:

Nope - innerHTML is universal - I believe.

Flawless
Alas not - it's not part of the W3C standards... NS6 only implemented it because loads of developers wanted it. Thus NS4.x does not support it. Dunno about Opera...

Read up here:
http://www.webreference.com/js/tips/001209.html
http://www.mozilla.org/docs/web-deve...e_2.html#other

However, this is a good guide to the cross-browser alternative:
http://www.pxl8.com/cloneNode.html

Don't give me wrong, I'm leaning towards ignoring NS4 users (!) but because others read and act on these posts I thought it was important to set the record straight!

 
      Jul 26, 2002, 19:42 12
  
arr k cheers m@rco, why can't people just upgrade or all developers force people to upgrade as some people dont even know what an upgrade is or how to do it lol, from what i saw the other day

 
 1 - 12 of 12 [Total 1 Pages]  









Subscribe to our mailing list
email


Current Location : Home > Web Development > JavaScript > Javascript in HTML Tables Share/Save/Bookmark    

Development problem? SageFix is completely free -- paid for by advertisers and donations. Click here to Contact Us If you have any query. Enjoy!
Request processed in 7.0E-5 seconds Home - Contact Us - Terms Of Service - Privacy Policy - Copyrights - Top
Advertisements do not imply our endorsement of that product or service.
Current server time now is 18-Mar-2010 06:10:29
Copyright © 2009 Sagefix Inc. All rights reserved.
Powered By SageFix