Advertisement

01.14.2005 at 09:42AM PST, ID: 21274849
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

document.write() vs DOM calls (createElement(), etc)

Asked by catbutt in JavaScript, Dynamic HTML (DHTML)

Tags:

I have some reusable components that can either be added to the page after the fact, or created during the initial render.  In the past, when I needed to display content with javascript during the initial render I have used document.write().

However, in the spirit of keeping things as clean and reusable as possible, I have been considering making everything using DOM calls (from low level "createElement" to the higher level innerHTML approach, often combining the two as in the example below). This allows me more flexibility than document.write().  However, I often want to display the elements during the initial render so that the page comes in as cleanly as possible -- if I add it in the body.onload event, it can look ugly to the user.

Is this approach ok?  My experimentation seems to work alright, but since I never see it in examples on the web, I'm worried it is an unsanctioned approach and might fail in some browsers.  For instance, creating a div in html, and then immediately getting the element by its id (before the rest of the page has rendered) and sticking something in that div.....it that ok?  Is there any advantage to document.write() in this situation? (aside from running in pre-DOM browsers)

Here is basically how I do it (in reality it would be used for very complex things, such as a table or something....):

<html><body>
<div id="foo">
</div>
<script language="javascript">
var elem = document.createElement("A");
elem.innerHTML = "go to yahoo";
elem.setAttribute ("class", "whatever");
elem.href = "http://www.yahoo.com";
document.getElementById ("foo").appendChild (elem);
</script>
</body></html>

I'd be particularly interested in seeing examples on the web where such an approach is used.

thanks






Start Free Trial
[+][-]01.14.2005 at 09:46AM PST, ID: 13046582

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.14.2005 at 09:46AM PST, ID: 13046590

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.14.2005 at 10:00AM PST, ID: 13046757

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.14.2005 at 10:07AM PST, ID: 13046843

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.14.2005 at 10:48AM PST, ID: 13047353

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.14.2005 at 11:29AM PST, ID: 13047764

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.14.2005 at 12:21PM PST, ID: 13048262

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.14.2005 at 12:34PM PST, ID: 13048393

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01.14.2005 at 01:14PM PST, ID: 13048833

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.14.2005 at 03:19PM PST, ID: 13050101

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: JavaScript, Dynamic HTML (DHTML)
Tags: javascript
Sign Up Now!
Solution Provided By: COBOLdinosaur
Participating Experts: 4
Solution Grade: A
 
 
[+][-]01.14.2005 at 03:37PM PST, ID: 13050220

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.14.2005 at 03:48PM PST, ID: 13050291

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.07.2005 at 01:59AM PDT, ID: 14385630

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.07.2005 at 04:21AM PDT, ID: 14386137

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 - Hierarchy