473,508 Members | 2,180 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Rewrite/replace table


Hi

What's the best/easiest/fastest way to rewrite a table in javascript...

I've tried something like:

var newgrid=document.createElement("table");
//add some rows and cells
var grid=getElementById("table1");
grid.innerHTML=newgrid.innerHTML;

however the last line gives me a runtime error, so I expect it not allowed
to change the innerHTML this way....

Any suggestions would be greatly appreciated.

TIA

Søren
May 29 '06 #1
2 4471
Søren M. Olesen wrote:
What's the best/easiest/fastest way to rewrite a table in javascript...
<URL:http://www.quirksmode.org/dom/innerhtml.html>
I've tried something like:

var newgrid=document.createElement("table");
//add some rows and cells
var grid=getElementById("table1");
The Global Object does not have a built-in or host-defined `getElementById'
method. It is a method of the object that can be referred to with
`document' instead.
grid.innerHTML=newgrid.innerHTML;
In contrast to the rest of your code, `innerHTML' is completely proprietary.
Do not expect consistent results.
however the last line gives me a runtime error, so I expect it not
allowed to change the innerHTML this way....
<URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1DontWork>
Any suggestions would be greatly appreciated.


Read the FAQ before you post: <URL:http://jibbering.com/faq/>
PointedEars

P.S.: Please declare your character encoding. <URL:http://insideoe.com/>
--
Multiple exclamation marks are a sure sign of a diseased mind.
-- Terry Pratchett
May 29 '06 #2

Søren M. Olesen wrote:
Hi

What's the best/easiest/fastest way to rewrite a table in javascript...

I've tried something like:

var newgrid=document.createElement("table");
//add some rows and cells
var grid=getElementById("table1");
grid.innerHTML=newgrid.innerHTML;


Replace grid entirely:
grid.parentNode.replaceChild(newgrid, grid);

May 29 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
14885
by: Daniel | last post by:
I use an Access database to basically take data exports, import them, manipulate the data, and then turn them into exportable reports. I do this using numerous macros, and queries to get the data...
5
3458
by: T | last post by:
Hi group, I'm trying to create a temporary replacement scheme for a particular url that gets generated all over an existing app. It would be very difficult to find every spot where the url gets...
4
2172
by: serge | last post by:
I managed to put together C# code and have it do the following: 1- Get all the table names that start with the letter "Z" from sysobjects of my SQL 2000 database and put these table names...
18
10055
chunk1978
by: chunk1978 | last post by:
hi everyone. i just started learning how to dynamically show/hide elements with a checkbox toggle. i would like to know if it's possible to delete/rewrite elements instead of simply show/hide...
6
15550
by: JackpipE | last post by:
Here is my replace query and I need to run this on every column in my table. Right now I manually enter the column name (_LANGUAGES_SPOKEN) but this is time consuming and would like to automate...
10
1299
by: not_a_commie | last post by:
I've seen studies before showing that it is better to rewrite code when more than 25% (or whatever) of the code needs to be changed. I can't seem to locate any references for that at the moment. Do...
4
5432
by: Harsh Trivedi | last post by:
Hi, We have implemented URL rewriting in our site. It all went OK till home page links. When we click on home page category control, where we have implemented rewriting, it works ok, and open...
3
3629
by: oravm | last post by:
Hi, I re-write a query and used bulk collect to improve the performance of the batch process. The query below has NO compile error but when execute query there is error 'ORA-01403: no data...
4
1361
by: vinpkl | last post by:
hi all i have a url like i used rewrite to make it seo friendly it gives me
0
7231
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7132
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7336
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7401
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5640
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3196
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1568
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
773
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
432
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.