473,799 Members | 3,276 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting innerHTML

Hey,

I have a DIV and I want to dynamically set its innerHTML. I know I can
set it by doing the following myDiv.innerHTML = '<img
src=\"myImage.g if\">'
However, the html that I want to set in it is quite large so I dont
want to have to hard code the HTML like I just did.
My question is....is it possible to assign an existing html page to the
innerHTML.
e.g. myDiv.innerHTML = 'mytest.html'
So that the contents of the mytest.html would be set in myDiv's
innerHTML.

Thanks,

Chris

Jun 6 '06
22 2384
Chris Moltisanti wrote:
The previous post is not related to javascript so please ignore it.


Why are you telling me what to do?

What post are you referring to?

Please quote what you are replying to. If you don't want to play by the
rules, then go play somewhere else.
--
"The most convoluted explanation that fits all the available and made-up
facts is the most likely to be believed by conspiracy theorists"
Jun 8 '06 #11

andy baxter wrote:
On Wed, 07 Jun 2006 01:36:29 -0700, Eric Ryan Harrison wrote:
Another more simplistic option would be to have your javascript merely
use document.create Element to create an iframe, set the iframes src to
whatever page you want the div to contain and then appendChild on the
div. Maybe not as clever or web2.0'ish enough for you, but it
definitely will get the job done in the least amount of code.

-E


I tried this way first, but I didn't like the iframe - you have to set a
fixed height window with a scrollbar and it looked ugly in my layout.


I don't know exactly what you're reffering to here. I've seen some
darned pretty Iframes. Iframes are CSS-ready, and if the page coming
back in the iframe has any sort of style, it'll be properly rendered as
well.

Good luck,

-E

Jun 9 '06 #12
JRS: In article <12************ *@corp.supernew s.com>, dated Thu, 8 Jun
2006 11:07:03 remote, seen in news:comp.lang. javascript, Tony <tony23@ds
lextreme.WHATIS THIS.com> posted :
Chris Moltisanti wrote:
The previous post is not related to javascript so please ignore it.


Why are you telling me what to do?

What post are you referring to?

Please quote what you are replying to. If you don't want to play by the
rules, then go play somewhere else.


He's a Google user, so don't assume intelligence; tell him to read the
newsgroup FAQ.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jun 9 '06 #13

Eric Ryan Harrison wrote:
andy baxter wrote:
I tried this way first, but I didn't like the iframe - you have to set a
fixed height window with a scrollbar and it looked ugly in my layout.


I don't know exactly what you're reffering to here. I've seen some
darned pretty Iframes. Iframes are CSS-ready, and if the page coming
back in the iframe has any sort of style, it'll be properly rendered as
well.

Good luck,


As far as I know, an iframe has to have a fixed height and any overflow
is dealt with by putting a scrollbar in the window. I didn't want that
- I just wanted the html included in the page like any other html text.

andy baxter (lofty00 while I'm away)

Jun 9 '06 #14
lo*****@fastmai l.fm wrote:
Eric Ryan Harrison wrote:
andy baxter wrote:
I tried this way first, but I didn't like the iframe - you have to set a
fixed height window with a scrollbar and it looked ugly in my layout.
I don't know exactly what you're reffering to here. I've seen some
darned pretty Iframes. Iframes are CSS-ready, and if the page coming
back in the iframe has any sort of style, it'll be properly rendered as
well.

Good luck,


As far as I know, an iframe has to have a fixed height and any overflow
is dealt with by putting a scrollbar in the window. I didn't want that
- I just wanted the html included in the page like any other html text.


Huh? I personally don't know what your source is for this. It may be
that this is true and I've just been using browsers that don't have
this behavior. I use IFrames in a few different places and have seen
this working on IE6, FF 1.0-1.5, Netscape 7, and Mozilla 1.6.

<h2>Default (Non-Pretty) Iframe</h2>
<iframe name="nonpretty " id="nonpretty"
src="javascript :void(0);"> </iframe>

<hr />

<h2>CSS Styled (Pretty) Iframe</h2>

<iframe name="pretty" id="pretty" src="javascript :void(0);"
style="backgrou nd-color:#fca;heig ht:300px;width: 600px;overflow: auto;border:1px
dashed #777;"> </iframe>

( I always add the   so that XML doesn't gak up on <iframe>
auto-closing the empty element when I do ajax stuff. &nbsp; isn't
recognized as a valid XML entity, so I use   which works like a
charm. )

Take a look. Should see beautiful iframes. Let me know if anything
crazy happens.

-E
andy baxter (lofty00 while I'm away)


Jun 9 '06 #15
Dr John Stockton said the following on 6/9/2006 12:23 PM:
JRS: In article <12************ *@corp.supernew s.com>, dated Thu, 8 Jun
2006 11:07:03 remote, seen in news:comp.lang. javascript, Tony <tony23@ds
lextreme.WHATIS THIS.com> posted :
Chris Moltisanti wrote:
The previous post is not related to javascript so please ignore it. Why are you telling me what to do?

What post are you referring to?

Please quote what you are replying to. If you don't want to play by the
rules, then go play somewhere else.


He's a Google user, so don't assume intelligence;


Being a "Google user" applies to many more people that what you thought
you intended to say. "Google Group user" isn't any better though. The
user of an interface is as much a reflection of intelligence as the
color of the sun - it isn't and it's irrelevant.

The only time you see problems with Google Groups is when a new person
is using it. You don't pay attention to the people who use it without
problems because you only pay attention to where they post from if there
is a problem in quoting.
tell him to read the newsgroup FAQ.


And nothing in that FAQ deals specifically with how to quote using
Google Groups so pointing a user to that FAQ doesn't help the problem
any at all.

A better reference would be somewhere that deals with that particular
piece of software. It is no different than pointing an un-patched OE
user to an OE-fix page, or do you point them to the FAQ as well in a
round of futility?

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 10 '06 #16

Eric Ryan Harrison wrote:
Huh? I personally don't know what your source is for this. It may be
that this is true and I've just been using browsers that don't have
this behavior. I use IFrames in a few different places and have seen
this working on IE6, FF 1.0-1.5, Netscape 7, and Mozilla 1.6.

<h2>Default (Non-Pretty) Iframe</h2>
<iframe name="nonpretty " id="nonpretty"
src="javascript :void(0);"> </iframe>

<hr />

<h2>CSS Styled (Pretty) Iframe</h2>

<iframe name="pretty" id="pretty" src="javascript :void(0);"
style="backgrou nd-color:#fca;heig ht:300px;width: 600px;overflow: auto;border:1px
dashed #777;"> </iframe>

( I always add the   so that XML doesn't gak up on <iframe>
auto-closing the empty element when I do ajax stuff. &nbsp; isn't
recognized as a valid XML entity, so I use   which works like a
charm. )

Take a look. Should see beautiful iframes. Let me know if anything
crazy happens.


I does look better that way, but if I include a document in the iframe
that's longer than the height of the frame, it makes a scrollbar on the
right hand side to deal with the overflow. This isn't what I want - I
want it to expand to the full length of the included document, with any
scrolling being through the scrollbar on the main window. I don't think
there's a way to do this with iframes.

andy

Jun 10 '06 #17
JRS: In article <Rq************ *************** ***@comcast.com >, dated
Sat, 10 Jun 2006 13:14:55 remote, seen in news:comp.lang. javascript,
Randy Webb <Hi************ @aol.com> posted :
tell him to read the newsgroup FAQ.


And nothing in that FAQ deals specifically with how to quote using
Google Groups so pointing a user to that FAQ doesn't help the problem
any at all.


You should read the newsgroup FAQ.

comp.lang.javas cript FAQ - 8.1 - 2005-11-05
Section 2.3, paragraph 7, which cites paragraph 6, refers.

(6) When replying to a message on the group quote the minimum of the
preceding messages post that is sufficient to provide context for the
reply but trim the remainder, and add your comments below the pertinent
section of quoted material, as per FYI28/RFC1855 (never top post).

(7) If posting through groups.google.c om don't use the "Reply" link at
the bottom of the article, instead use "Show Options" at the top of the
article and than click the "Reply" option exposed there. This
automatically includes the quote of the preceding message to be edited
down as described above.
I leave the following in HTML for the convenience of those who might
wish to put something similar on their sites :-

<p>Also see <a
href="http://groups.google.c om/support/bin/answer.py?answe r=14213">How
can I automatically quote the previous message when I post a reply?</a>
in Google Groups Help.</p>
<FAQENTRY> In the first line of 2.3 para 6, suggest inserting ", with
'>', " in the first line.

--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demo n.co.uk/> - FAQish topics, acronyms, & links.
For more on our news hierarchy news:uk.*, see newsgroups news:uk.answers and
news:uk.net.new s.*, and <URL:http://www.usenet.org. uk/>.
Jun 10 '06 #18
Dr John Stockton said the following on 6/10/2006 5:42 PM:
JRS: In article <Rq************ *************** ***@comcast.com >, dated
Sat, 10 Jun 2006 13:14:55 remote, seen in news:comp.lang. javascript,
Randy Webb <Hi************ @aol.com> posted :
tell him to read the newsgroup FAQ.

And nothing in that FAQ deals specifically with how to quote using
Google Groups so pointing a user to that FAQ doesn't help the problem
any at all.


You should read the newsgroup FAQ.

comp.lang.javas cript FAQ - 8.1 - 2005-11-05
Section 2.3, paragraph 7, which cites paragraph 6, refers.


I did, and the version at <URL: http://jibbering.com/faq/> that I get is :

comp.lang.javas cript FAQ - 8.0 - 2004-03-15

Which is obviously wrong but it is the same version that anybody else
would get unless a URL to a post of it in the archives is given instead.
I got tired of messing with Google Groups to try to find a URL to the
last FAQ Poster posted FAQ article. Does anybody have one?

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 10 '06 #19

lo*****@fastmai l.fm wrote:
Eric Ryan Harrison wrote:
Huh? I personally don't know what your source is for this. It may be
that this is true and I've just been using browsers that don't have
this behavior. I use IFrames in a few different places and have seen
this working on IE6, FF 1.0-1.5, Netscape 7, and Mozilla 1.6.

<h2>Default (Non-Pretty) Iframe</h2>
<iframe name="nonpretty " id="nonpretty"
src="javascript :void(0);"> </iframe>

<hr />

<h2>CSS Styled (Pretty) Iframe</h2>

<iframe name="pretty" id="pretty" src="javascript :void(0);"
style="backgrou nd-color:#fca;heig ht:300px;width: 600px;overflow: auto;border:1px
dashed #777;"> </iframe>

( I always add the   so that XML doesn't gak up on <iframe>
auto-closing the empty element when I do ajax stuff. &nbsp; isn't
recognized as a valid XML entity, so I use   which works like a
charm. )

Take a look. Should see beautiful iframes. Let me know if anything
crazy happens.
I does look better that way, but if I include a document in the iframe
that's longer than the height of the frame, it makes a scrollbar on the
right hand side to deal with the overflow. This isn't what I want - I
want it to expand to the full length of the included document, with any
scrolling being through the scrollbar on the main window. I don't think
there's a way to do this with iframes.


Have you tried this: ( note: I haven't tested this, so if it doesn't
work, let me know )

<iframe name="pretty" id="pretty" src="http://google.com"
style="backgrou nd-color:#fca;heig ht:300px;width: 600px;overflow: visible;border: 1px
dashed #777;"> </iframe>

CSS's overflow:visibl e property is supposed to do just that. Anything
bigger than your defined size will cause the element to expand to show
the containing data.

Give this a try.

-E andy


Jun 11 '06 #20

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

Similar topics

4
47587
by: Kerri | last post by:
Hi, I have a span as below. <span id="lblTest" style="color:#FF0033;font- weight:bold;">This is a test.</span> When the user clicks a checkbox I call below code to set my span text to blank.
2
3569
by: Kerri | last post by:
Sorry, That was a typo. It should read. I have a RequiredFieldValidator This gets rendered out as a <span> I want to set the innerHTML.
7
4898
by: Harag | last post by:
Hi all I think this is in the wrong group but since I don't read others much or code in java script I was wondering if anyone could help me with this small problem, as I code mostly in ASP vbscript. I have the following piece of Javascript client code that displays the users clock on the browser and updates it every second.
5
21634
by: Soren Vejrum | last post by:
I am working on a web-based html editor using MSIE's designmode and iframes. Everything works just fine, but MSIE changes all my relative "a href" and "img src" links (i.e. "/index.asp") to absolute links (i.e. "http://localhost/index.asp") when I set the iframe's innerHTML. This is bad as the links are supposed to be relative. How can I avoid this? Any solutions/suggestions are much appreciated.
7
4870
by: Christopher J. Hahn | last post by:
I'm trying to use a script-generated form to submit to a script-generated iframe. The problem I'm running into is that the iframe is not assuming the name I assign it. IE6 on Win2000. FF1.0.2+ doesn't seem to have the problem. I'm doing: this.iframe = document.createElement( 'iframe' ); this.iframe.id = this.id + 'wh'; this.iframe.style.display = 'none';
10
1786
by: johndoe | last post by:
While creating a shopping cart application I noticed a strange bug which resulted in the Constructor and everything being called twice. I was using Inherited classes ClassShowProducts inherited TemplatePage which inherited System.Web.UI.Page which I thought was the problem so I spent all day recoding everything so that ClassShowProducts was inherited from System.Web.UI.Page. Then I found out that it still happend. I then quickly narrowed it...
5
1385
by: verrice | last post by:
Hello, I'm writing a web application where I want to load bits of data at runtime from the client end (via AJAX). The loading of the data part works great, but for some reason anytime I try to impart a style setting (via either putting it inline, a CSS, or through javascript) the DIV completely ignores my setting. The setting most importantly I'm trying to apply is display: none, but none of them work. If I pre-create everything...
1
2244
by: robbiedoo | last post by:
How can a value be set to a label in javascript. I can set values to <h6> tags, but I need to set the value of a label. Particularly becasue I can't seem to acces the value of an <h6> tag in the aspx.vb code-behind on the aspx page. So far I got the changing of <h6> values working by doing this: function SellLots_DoFSCommand(command, args){ if(args != "" && args != null) { ...
8
10112
Toxinhead
by: Toxinhead | last post by:
Hey there guys I am having a little trouble with InnerHTML as i can't seem to figure out how to set the style of my div tag..... What im trying to do is that when i rollover pic1 it changes that pic and displays:block and visiblity:visible....and also changes pic2.. When the webpage is loaded it displays:none and visivlity:hidden also Heres my code:
0
9687
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
9541
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
10251
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
10228
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
9072
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
7565
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
6805
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();...
1
4141
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
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.