473,569 Members | 2,648 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using JS "WRITE" type functionality without erasing the original page.

Is it possible? I'm trying to add to the current page -- but add at a
specific point. Can add HTML tags from javascript midway through the page
(at a place I specify) without erasing the existing page?

Thanks,
Eric
Jul 20 '05 #1
5 4896
In article <bf************ @ID-144898.news.uni-berlin.de>, "Eric"
<um**@psyon.org > writes:

Is it possible? I'm trying to add to the current page -- but add at a
specific point. Can add HTML tags from javascript midway through the page
(at a place I specify) without erasing the existing page?

Try reading the group FAQ at http://www.jibbering.com/faq/
and specifically http://www.jibbering.com/faq/#FAQ4_15

--
Randy
All code posted is dependent upon the viewing browser
supporting the methods called, and Javascript being enabled.
Jul 20 '05 #2
Right -- but DOM2 isn't universally supported (not that javascript is -- but
I wanted to do a little bit better than IE5). Is this my only option?

Thanks,
Eric
Jul 20 '05 #3
"Eric" <um**@psyon.org > writes:

Please keep a little of the post you are answering so we can see wha
you refer to.
Right -- but DOM2 isn't universally supported (not that javascript is -- but
I wanted to do a little bit better than IE5).
What does IE5 do, and what would be better?
Is this my only option?


(the one in the FAQ?)

It is a *good* option. It works in IE4+, NS6+ and Opera 7.

The code is not very pretty, though. Try this instead:
---
function writeHTML(id,S) {
var elem = (document.getEl ementById ? document.getEle mentById(id) :
(document.all ? document.all[id] : undefined));
if (!elem) { return false; }
elem.innerHTML = S;
return true;
}
---
It works in any browser that understands .innerHTML. Adding support
for NS4 requires some extra work, but is possible if the element
to write into is absolutely positioned.

I don't know what other browsers are out there that allows changing
the contents of the page dynamically.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #4
On Mon, 21 Jul 2003 00:02:17 -0700, "Eric" <um**@psyon.org > wrote:
Right -- but DOM2 isn't universally supported (not that javascript is -- but
I wanted to do a little bit better than IE5). Is this my only option?

If you don't want to use innerHTML etc. then you could include a
JavaScript document.write( ) in the HTML document at the appropritate
point.

If you need to alter is after the HTML page hase rendered then reload
the page with the variables driving the document.write( ) primed to
include the new data.

This might require using data saved in another frame, or cookie etc.

HTH
Jul 20 '05 #5
I never even thought of placing the document.write statement within the
document as opposed to the beginning or end of the document.

Thanks!
Jul 20 '05 #6

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

Similar topics

0
2030
by: mc kim via .NET 247 | last post by:
What I am trying to is automatic bidding process in Ebay site... WebClient class can uploads form data easily. I have collected ebay url & form data to uploads.. Most of process is quite easy and simple. But ebay webserver send me your password is not valid... But the password is clearly correct.. you can type it at the result page and...
2
5756
by: bissatch | last post by:
Hi, I am trying to use JavaScript to write a table column on a web page. The code is as follows: <html> <head> <script> function displaycount() {
9
4010
by: mallyonline | last post by:
I last posted to this group about 6 months ago and was very pleased by the excellent response I got and the great help offered to me. I am back this time with another request for your expert help on a bit of ASP code I use on my windows server 2003 with IIS6 machine. I would like the code below to display in different colours depending on...
34
18220
by: John Harrison | last post by:
An odd confession; an odd request; but here's the tale.... My company has a few PC systems which we have used for about 7 years and not updated - we've "made do", and besides, "if it ain't broke....." as they say. Anyway, everything's finally getting replaced by a new set-up, and there is just one program, an Access program running under...
10
1907
by: Stuart Brierley | last post by:
Does anyone have any ideas how to open a new web browser window in .NET? I'm using ASP.NET with VB as the code behind, and after some (server side) validation code may need to open a second browser window. Any help gratefully received. Cheers
4
2736
by: bennett | last post by:
How can I do a loop from 1 to 5, where on line 1 I print 1 space followed by a button, on line 2 I print 2 spaces followed by a button, on line 3 I print 3 spaces followed by a button, etc.? I tried this code: for (int i = 1; i <= 5 ; ++i) { for (int j = 1; j <= i; ++j) {
0
1299
by: Benny | last post by:
I'm testing to see whether msbuild can replace nmake. project file <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Target Name="test"> <Exec Command="test.exe"/> </Target>
3
2632
by: cc50818j | last post by:
Hi, Can anyone suggest a Unix command or c-shell algorithm to simulate to behavior of "wall" command minus the "all users"? What I'm trying to do is to send a notice to just one particular user but i dont want other remotely-logged-on users to receive the message (on the pseudo-terminals). I cannot use the "write" command for three reasons:...
1
5795
by: Curious | last post by:
I want to write to an output file, "C:\\temp\\debug.txt": If the file exists, append the new content to the end of the file (instead of overwriting the current content). If the file doesn't exist, create the file and write from the beginning. Therefore, I want to code this like below: FileInfo lFile = new FileInfo("C:\\temp\\debug.txt");...
0
7701
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...
0
7615
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...
0
8130
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7979
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
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...
0
3653
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...
1
2115
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
1
1223
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
940
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...

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.