473,414 Members | 1,876 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Replacing Tables

Hello,

I am trying to replace a table that is setting inside a div tag. The reason is that I want to replace a table through AJAX instead of using postbacks or Iframes. The table is built on the server then sent back to the webpage as a string. I am trying to avoid parsing the string and recreating every control within the object. I had hoped that I could use innerHtml on the div tag, but this doesn't work. Does anyone know of an article already written on this that I could use. Final note, the solution needs to work with lastest version of Firefox (MAC and Windows versions) and IE 7.

Thanks,
Leo
Mar 8 '07 #1
7 1487
acoder
16,027 Expert Mod 8TB
Welcome to TSDN - TheScripts.

What code do you have so far?
Mar 8 '07 #2
I would like to know if there is an easy to replace a table and its contents on the client side. I am using AJAX to return a string that holds all the table and its contents as it would appear in an HTML page. The table is currently setting inside a div tag, but if there is an easier way, I am game. I had thought that that document.getElementById('element').innerHtml = data would work, but it doesn't remove or replace the contents. I am trying to avoid parsing and building the table by creating every row, cell and contents individually. The solution needs to be a cross platform solution (firefox and IE at least).

Thanks,
Leo
Mar 8 '07 #3
<pre>
function RefreshTable(result, context)
{
if(result == null || result == "")
alert("Error updating database");
else
{
// replace table
var data = result.split("|"); // Split list into two pieces
// First piece is control id, second table string
if(data.length == 2)
{
document.getElementById(data[0]).innerHtml = data[1];
}
}
return false;
}
</pre>

This is the function that does the update. Result is in two pieces. The first is the name of the div tag, the second is literally a string of text that has everything for the table formatted like the table would be described in standard html.

Thanks,
Leo
Mar 8 '07 #4
acoder
16,027 Expert Mod 8TB
Merged threads.
Mar 8 '07 #5
acoder
16,027 Expert Mod 8TB
innerHtml should be innerHTML. Javascript is case-sensitive.
Mar 8 '07 #6
Thanks, that was it. Is there a location that has a list of the standard tags and thier properties, functions and events?

Thanks,

Leo
Mar 8 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

40
by: Mason A. Clark | last post by:
CSS Experts: OK, I'm a stupid newby. Now, here's the question: Can CSS replace slightly complicated Tables and work in three browsers (e.g. MSIE 6.0, Net 7.1, Op 7.03) ? After countless...
7
by: Wilhelm Kutting | last post by:
Hi again i want to replace the following layouttabel with css/xhtml: ---------------------------------- <table width="640" cellspacing="0"> <tr> <td valign="top">My Title</td> <td...
3
by: Paolo | last post by:
Friends, I have a split database and would like to make some updates to share with all users in various Offices in the World. I would like just to send them a new mdb file which will contain the...
2
by: dan graziano | last post by:
Hi, I currently have a five table and query system created in access. Basically the structure is fixed. But I have to run the query over numerous times using different updates of the tables. ...
18
by: blueapricot416 | last post by:
I am on a team designing the front end of an Intranet application. The backend guys will be using JSP and AJAX-like functionality to make server requests that must dynamically change elements on a...
1
by: gViscardi | last post by:
Hello all, Ok, so what I am attempting to accomplish is to replace my table-based website with a CSS layout site, but I have run into a few hitches. My main problem is that currently my website...
1
by: cma6 | last post by:
I have a page which uses tables for layout http://www.vintagetextile.com/1920s_to_1930s.htm The checkerboard pattern is achieved with this markup: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML...
10
by: Scott M. | last post by:
I've seen many posts and ready articles discussing how changing the membership & roles "provider" in VS .NET is easy, but have yet to see instructions on how to do it. If I already have SQL...
1
by: =?ISO-8859-1?Q?S=F8ren?= | last post by:
Hi guys I got the following code: ------------------------------------------------------- Dim Word As New Microsoft.Office.Interop.Word.Application Dim Document As...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.