473,382 Members | 1,752 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,382 software developers and data experts.

javascript performance inquiry, myDiv.innerHTML = content;

Hello,
I am experimenting with various ways of passing content between
javascript and server.

Originally i was performing xsl transformation with javascript, but I
noticed some performance issues when the size of the xml document was
growing too large (1000+ rows).

Now i am doing everything on the server, and passing xsl formatted
content back to javascript.

problem:

var myContent = server.getFormattedContent();
myContent.length = 400100; // etc
***************************************
myContentDiv.innerHTML = myContent;
***************************************

the brwoser will freeze for a second while that last line executes.

Is there any way to make it async ? or any way at all to get rid of
that browser freeze ?

I am also including pagination to decrease the size of document per
page, but really curious in available remedies to the problem described
above ( setting innerHTML with large content variable )
TIA

Jul 23 '05 #1
1 2119
Jc
sonic wrote:
problem:

var myContent = server.getFormattedContent();
myContent.length = 400100; // etc
***************************************
myContentDiv.innerHTML = myContent;
***************************************

the brwoser will freeze for a second while that last line executes.

Is there any way to make it async ? or any way at all to get rid of
that browser freeze ?


AFAIK, you can't make that call async. Also, be aware that innerHTML is
not part of the official DOM. Now, I realize you are probably trying to
make the user experience richer by avoiding a page refresh, but
displaying formatted HTML from a server is what the browser itself is
designed/optimized for, by setting the page location to the appropriate
URL.

Using a scripting language to bypass this is going to be slower, and
there is going to be a delay, just like there is a delay as the browser
parses and displays a webpage when the browser navigates to a new page.
Taking a large string of HTML and parsing/rendering it isn't a trivial
task, and you're going to see that code perform even worse for users
with slower machines.

Perhaps the task you are trying to accomplish would better be suited to
a page reload of either the entire page or perhaps one of the frames of
a frameset. A feature such as a site that acts like a frameset without
actually using a frameset (and avoiding framing issues, such as
bookmark problems) using AJAX is not going to be as scalable if
implemented in a scripting language.

Another idea is to use a page reload/frameset for content that exceeds
a certain size, and only use the scripted version for content that has
acceptable performance.

Jul 23 '05 #2

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

Similar topics

72
by: Stephen Poley | last post by:
I have quite often (as have probably many of you) come across HTML forms with irritating bits of Javascript attached. The last straw on this particular camel's back was a large form I was asked to...
1
by: Paul | last post by:
Here is my current code: ------------ <script runat=Server> void Page_Load(object sender, EventArgs e){ if (!IsPostBack){ myDiv.InnerHtml = "Original Content"; } //On Postback, should equal...
11
by: trinitypete | last post by:
Hi all, I have a user control that uses control literal to build a heading with a link, and a div containing links below. As the link heading is hit, I want to change the style of the div,...
10
by: Emre Sevinc | last post by:
Take a look at the following snippet: <html> <head> <script> function add(elementId) { var container = document.getElementById(elementId); for (var i = 0; i < 10; i++) { var elt =...
11
by: Giakko | last post by:
Dear reader.. i have a page that opens a popup window from this popup window i have to change some opener divs innerHTML content, how can i do? this is how i do, (and it doens't work): THE...
7
by: John | last post by:
Hi Everyone, I'm having this extremely annoying problem with Internet Explorer 6, giving me an error message saying "unknown runtime error" whenever I try to alter the contents of a <divelement...
13
by: Walton | last post by:
I'm wondering if anyone knows or knows where to find a collection of javascript "brain teasers" for lack of a better description. Companies use these types of tests for programmers all the time...
3
by: SM | last post by:
Hello, Im trying to access elements in my XML file using the JavaScript DOM but i'm not sure how. I use AJAX to access the XML and then use the responseXML property to access the XML file data. I...
6
by: cantrell78 | last post by:
I can't for the life of me figure out how to execute javascript inside of div that was set using innerHTML or in my case using cloneNode and replaceChild (not my idea to do this, I'm just fixing...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.