473,769 Members | 5,784 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FAQ Topic - How do I modify the current page in a browser?

-----------------------------------------------------------------------
FAQ Topic - How do I modify the current page in a browser?
-----------------------------------------------------------------------

Using the DOM the non-standard but widely implemented innerHTML
extension, the following would be sufficient to modify the content
of any element that can have content:
« <div id="anID">Some Content</div» with script of
« document.getEle mentById("anID" ).innerHTML=
"Some <em>new</emContent"; »
Where "anID" is the (unique on the HTML page) ID attribute value
of the element to modify.

The script below adds support for « document.all » capable browsers.
Support for NN4 is also possible, but certain issues mean that
it is not listed here. Using the example above, the call would
be written:
« DynWrite('anID' ,"Some <em>new</emContent") »
With the below code also in the page:

DocDom = (document.getEl ementById?true: false);
DocAll = (document.all?t rue:false);
DocStr=''
if (DocAll) DocStr="return document.all[id]"
if (DocDom) DocStr="return document.getEle mentById(id)"
GetRef=new Function("id", DocStr)
if (DocStr=='') { DynWrite=new Function("retur n false") } else {
DynWrite=new Function("id", "S", "GetRef(id).inn erHTML=S; return true")
}

An alternative DynWrite function:

http://www.jibbering.com/faq/faq_not..._dynwrite.html

http://msdn.microsoft.com/workshop/a.../innerHTML.asp

http://www.mozilla.org/docs/dom/domr...8.html#1018427
===
Postings such as this are automatically sent once a day. Their
goal is to answer repeated questions, and to offer the content to
the community for continuous evaluation/improvement. The complete
comp.lang.javas cript FAQ is at http://jibbering.com/faq/index.html.
The FAQ workers are a group of volunteers.

Feb 21 '07 #1
3 1967
FAQ server said the following on 2/20/2007 7:00 PM:
-----------------------------------------------------------------------
FAQ Topic - How do I modify the current page in a browser?
-----------------------------------------------------------------------

Using the DOM the non-standard but widely implemented innerHTML
extension, the following would be sufficient to modify the content
of any element that can have content:
That sentence doesn't read very well. It is either badly worded or is
missing some punctuation.
--
Randy
Chance Favors The Prepared Mind
comp.lang.javas cript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Feb 21 '07 #2
FAQ server scribed:
>-----------------------------------------------------------------------
FAQ Topic - How do I modify the current page in a browser?
-----------------------------------------------------------------------

Using the DOM the non-standard but widely implemented innerHTML
extension, the following would be sufficient to modify the content
of any element that can have content:
« <div id="anID">Some Content</div»
I don't have any content between the tags, and my app seems to work fine. Is
there some reason I might want to include some content (&nbsp; comes to
mind)?
--
Ed Jay (remove 'M' to respond by email)
Feb 21 '07 #3
In comp.lang.javas cript message <v3tnt295t723jq pqeueufgnntva2m fll13@4ax.
com>, Tue, 20 Feb 2007 23:30:30, Ed Jay <ed***@aes-intl.composted:
>FAQ server scribed:
>>-----------------------------------------------------------------------
FAQ Topic - How do I modify the current page in a browser?
-----------------------------------------------------------------------

Using the DOM the non-standard but widely implemented innerHTML
extension, the following would be sufficient to modify the content
of any element that can have content:
‹ <div id="anID">Some Content</div›

I don't have any content between the tags, and my app seems to work fine. Is
there some reason I might want to include some content (&nbsp; comes to
mind)?
I have a page that uses javascript to fill DIVs or SPANs.

The first of such is, roughly <span>NO GOOD</span>, content immediately
replaced on page load using javascript by "ALL OK" or suchlike. Those
without script are duly warned that they are missing something. The
page is useful without script but more useful with it; there's no other
means available to substitute for script.

Then, while developing a page, it might be useful to see where the SPAN
actually is without actually writing to it. So write <span ID=Jim>Jim
is here!</spanand remember to clean it out before publication.

One can, of course, put SPAN content in the HTML and replace it by ""
with javascript later.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v6.05 IE 6
news:comp.lang. javascript FAQ <URL:http://www.jibbering.c om/faq/index.html>.
<URL:http://www.merlyn.demo n.co.uk/js-index.htmjscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/TP/BP/Delphi/jscr/&c, FAQ items, links.
Feb 21 '07 #4

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

Similar topics

1
263
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current page in a browser? ----------------------------------------------------------------------- Using the DOM and Microsoft's innerHTML extension, the following would be sufficient to modify the content of any element that can have content: `` <div id="anID">Some Content</div'' with script of ``...
31
3543
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current browser window? ----------------------------------------------------------------------- In a default security environment you are very limited in how much you can modify the current browser window. You can use ` window.resizeTo ` or ` window.moveTo ` to resize or move a window respectively, but that is it. Normally you can...
1
1281
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current page in a browser? ----------------------------------------------------------------------- Using the DOM the non-standard but widely implemented innerHTML extension, the following would be sufficient to modify the content of any element that can have content: ` <div id="anID">Some Content</div` with script of `...
0
9423
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
10216
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10049
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9997
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9865
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
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
6675
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();...
2
3565
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
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.