473,666 Members | 2,617 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Difference between document.body.i nnerHTML and document.write

7 New Member
This is to discuss pros and cons of each other.
Oct 12 '07 #1
1 5751
acoder
16,027 Recognized Expert Moderator MVP
You'd use document.write while the page is loading. innerHTML can be used after the page has loaded.

innerHTML is not restricted to the body only.
Oct 15 '07 #2

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

Similar topics

4
2036
by: Dante | last post by:
Hello. I have a Javascript that gets data from an XML document and displays it through javascript. The problem is that when I do dcfile.getElementsByTagName("subhead").firstChild.nodeName all I get is #text. Can you tell me why? Here is my code: /* The Dante-Cubed Standardized Markup Language Javascript API ------ Written by Sean M. Hall, Dante, and Peter-Paul Koch
3
516
by: Trevor Stapleton | last post by:
can anyone tell me how to stop the document.write opening a new window when called in a function, what I want to do is really simple but is is defeating at every turn. I have a line of text that is a link on an html page, when clicked i want the the function called to print a name, imediatly after the calling link (on the same page) please help whilst I still have some hair left. TIA Trevor
14
4112
by: Eli | last post by:
I've got a script that I'm trying to debug which uses document.write() to place HTML within a page. In both IE6 and Firefox when I view source, I see only the script itself and not any HTML as it's being written into the page. Is there a way that I can view what is being placed into the page, instead of, or in addition to the javascript code?
14
4065
by: christopher.secord | last post by:
Can someone please tell me why this works: document.body.innerHTML = "<table><tr><th>one</th></tr><tr><td>two</td></tr></table>"; But this does not work: document.body.innerHTML = "<table><tr>"; document.body.innerHTML = document.body.innerHTML + "<th>one</th></tr><tr><td>two</td></tr></table>";
3
8576
by: Alexander Mikhailian | last post by:
I have an http = new XMLHttpRequest(); that provides me with an http.responseXML. Somewhere deep in the http.responseXML there is a fragment called e.g. mydom that I want to copy with all its children to the document. document.getElementsByTagName('body').innerHTML=mydom; does not work. What should I do? Traverse mydom manually? Look for a JS library that does this already?
4
2059
by: Tom | last post by:
Hi, this snippet of code gives an error in Firefox but works just fine in IE. <html> <head> <script type="text/javascript"> function start(){ statusarray = new Array(); document.write("Test"); // This outputs text as expected statusarray="0"; //FF says that statusarray is undefined.
4
1946
by: robert.waters | last post by:
Hello, When the following page is executed in IE6, it generates script errors ('object expected') for any function that is declared in an external ..js file. Why is this???? This code works in Firefox 1.07 and 1.5. (The following code, when the body's onload event is triggered, simply rewrites the page using documentElement.innerHTML) //------------test.html-------------------- <html> <head>
1
3417
by: alex.sherwin | last post by:
Working on a google homepage module. One of the things I do is retrieve results from a search into a string. I want to be able to access all the anchors in this string, (their name, href, and innerHTML) and using regex for string parsing would be tiresome and difficult for this. I've searched far and wide, but I can't seem to find out if its possible to create a new document object (that doesnt refer to the current document) with a...
8
9411
by: '69 Camaro | last post by:
Perhaps I'm Googling for the wrong terms. Does anyone have links to examples of the syntax necessary to read the HTML on another Web page when that HTML is produced from JavaScript using the document.write( ) method? For a simplified example, I have two Web pages. Page 1 uses JavaScript with the following: htmlData = "<B>This is bold text.</B>"; document.write(htmlData);
6
7225
by: Rob | last post by:
Hello, I'm sure this has come up before. I have need for a collection of all elements/objects in an HTML document that have any kind of an attribute (HTML or CSS) that is making use of a URL to display an image. document.images only seems to reference image tags. The collection needs to include background images, input type = image, image maps, css assigned background, etc. Honestly, I am probably not aware of all the possibilities...
0
8454
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8363
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
7389
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6203
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5672
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4200
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
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 we have to send another system
2
1778
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.