473,397 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Cascading not happening with javascript page loading

Hi,

This is my first post here, so please be kind.

I have tryed to make a javascript html page loader by using an
invisible <IFrame> and some javascript variable text passing between
entities.

This seems to brake the CSS after some depth, or perhaps I am not
understanding something.
The idea is that I have an inner <div> that has a background image and
it does not show up in the loaded page.

Can you help me with it please?

http://zamolxisinteractive.com/default.html

Thanks.

Mar 18 '06 #1
5 2175
Anyone?

Here is what I do in a nutshell:

I have a simple HTML page with a hidden IFrame. In the IFrame page, at
the end, I have the following javascript:
"this.parent.make_global(document.getElementById(" a_div_from_IFrame").innerHTML);"

The make_global function resides in the main HTML page and it mainly
copies the given content to a global variable.

Later on, in the main page's onLoad event I substitute the innerHTML of
a div with the loaded content.

The problem is that the CSS of some of the innermost <div> tags from
the IFrame page doesn't show up correctly. (The background-image
doesn't show up at all).

Can you point me in the right direction please? Or give me another idea
how to make a cross browser page loader? Thanks.

Mar 19 '06 #2
tu********@gmail.com wrote on 19 mrt 2006 in comp.lang.javascript:
Anyone?
Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at the
top of the article, then click on the "Reply" at the bottom of the
article headers. <http://www.safalra.com/special/googlegroupsreply/>

Here is what I do in a nutshell:

I have a simple HTML page with a hidden IFrame. In the IFrame page, at
the end, I have the following javascript:
"this.parent.make_global(document.getElementById(" a_div_from_IFrame").i
nnerHTML);"

The make_global function resides in the main HTML page and it mainly
copies the given content to a global variable.

Later on, in the main page's onLoad event I substitute the innerHTML
of a div with the loaded content.

The problem is that the CSS of some of the innermost <div> tags from
the IFrame page doesn't show up correctly. (The background-image
doesn't show up at all).
But your code is in the iframe and directed to the container page,
so what would iframe page css have to do with it?

Container frame css does not cascade into the iframe page.
Can you point me in the right direction please? Or give me another
idea how to make a cross browser page loader? Thanks.


Show us the URL or a short version of a code demonstrating this behavour.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 19 '06 #3
Evertjan. wrote:
tu********@gmail.com wrote on 19 mrt 2006 in comp.lang.javascript:
Anyone?


Please quote what you are replying to.

If you want to post a followup via groups.google.com, don't use the
"Reply" link at the bottom of the article. Click on "show options" at the
top of the article, then click on the "Reply" at the bottom of the
article headers. <http://www.safalra.com/special/googlegroupsreply/>

Here is what I do in a nutshell:

I have a simple HTML page with a hidden IFrame. In the IFrame page, at
the end, I have the following javascript:
"this.parent.make_global(document.getElementById(" a_div_from_IFrame").i
nnerHTML);"

The make_global function resides in the main HTML page and it mainly
copies the given content to a global variable.

Later on, in the main page's onLoad event I substitute the innerHTML
of a div with the loaded content.

The problem is that the CSS of some of the innermost <div> tags from
the IFrame page doesn't show up correctly. (The background-image
doesn't show up at all).


But your code is in the iframe and directed to the container page,
so what would iframe page css have to do with it?

Container frame css does not cascade into the iframe page.
Can you point me in the right direction please? Or give me another
idea how to make a cross browser page loader? Thanks.


Show us the URL or a short version of a code demonstrating this behavour.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)


What I mean is that I have a page structure like this:

"default.html" (main page, the index, the loader page):

<html>
<head>
<script language="javascript" type="text/javascript">
<!--
var global_variable_1 = "<p>No page founf</p>";

function make_global(variable_a)
{
global_variable_1 = variable_a;
}

function present_site()
{
document.getElementById("where_to_put_loaded_page" ).innerHTML =
global_variable_1;
}

//-->
</script>
</head>
<body onload="present_site()">
[...]
<div id="where_to_put_loaded_page">
Initial text here is: no page loaded.
</div>
<iframe style="visibility: hidden" src="page1.html"></iframe>
</body>
</html>

"page1.html" (loaded page):
<html>
<body>
[...]
<div id="meaningful_content">
Here I put the content that I want dynamically loaded in the main page.
</div>
[...]
<script language="javascript" type="text/javascript">
<!--

this.parent.make_global(document.getElementById("m eaningful_content").innerHTML);

//-->
</script>
</body>
</html>

So basically I send the content from the IFrame to the main page via a
global variable and take/replace it via innerHTML.

The address where you can see this is:
http://zamolxisinteractive.com/default.html (main page)
http://zamolxisinteractive.com/page1.html (content for iframe)

It is a bit more complex there but the mechanism is what I described
above.

The problem can be seen at the bottom of the telephone images. There I
end up with some <div>s that have a CSS class that should make them of
a certain size and put a background telephone image on them (same image
as the above 2 rows). (The text inside the divs is: "here should
appear a telephone image in background"). The CSS in both IFrame and
index page is the same one, template.css.

Is there something wrong with my approach?

Mar 19 '06 #4
tu********@gmail.com wrote on 19 mrt 2006 in comp.lang.javascript:
<script language="javascript" type="text/javascript">
leave the language="javascript" out, not needed anymore.
<!--
leave the <!-- out, not needed anymore.
this.parent.make_global(document.getElementById("m eaningful_content").i
nnerHTML);
You cannot call a javascript function from a child iframe, I presume.

You could however easily test for that,
also by duplicating this function in the iframed page.
//-->
same
</script>


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Mar 19 '06 #5
Evertjan. wrote:
tu********@gmail.com wrote on 19 mrt 2006 in comp.lang.javascript:
this.parent.make_global(document.getElementById("m eaningful_content").i
nnerHTML);


You cannot call a javascript function from a child iframe, I presume.

You could however easily test for that,
also by duplicating this function in the iframed page.
Evertjan.
The Netherlands.


well, the function works, because the HTML tags arrive where they
should be. Only the css
does not work correctly, certain parts of the css to be more exact.
(background-image is the worst).

I've solved it for now by using embedded styles instead of classes, but
I really dont like that.

What other ways to dynamically load a html page with javascript are
there?
(I mean to have a part of a page show any of the site's loadable html
subpages).

Mar 19 '06 #6

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

Similar topics

7
by: Marci | last post by:
I found this script for cascading menus, however, I cannot reach the author to solve the bug I am having when I add a second menu to it. My problem is this: If I click on the first link, the...
5
by: Colin Walls | last post by:
I have been asked to produce a web catalogue of services and associated options, this eventually will be used for ordering the services. My initial thought was to use a set of cascading drop...
5
by: JezB | last post by:
Is it possible to programatically examine and modify a page's Styles (including Cascading Style Sheets) within the code-behind-module (eg. c#) ? My guess is that since these are HTML elements the...
19
by: LP | last post by:
I am using (trying to) CR version XI, cascading parameters feature works it asks user to enter params. But if page is resubmitted. It prompts for params again. I did set...
1
by: dkirkdrei | last post by:
I am using the javascript below in conjuction with PHP to dynamically build a cascading menu of part assemblies from a database. The cascading menu allows the user to "drill" down to the single...
6
by: Venkatesh | last post by:
Hello All, I have couple of doubts regarding the concept of on-demand javascript loading using javascript code. I could see on the net different techniques for achieving this - techniques like:...
13
eragon
by: eragon | last post by:
JavaScript Loading Mask Requirements: Little knowledge in JavaScript and some HTML. JavaScript enabled browser. Applications: Useful for all those pages that load slow, and in sections, so...
4
klarae99
by: klarae99 | last post by:
Hello, I am working on an Access 2003 Database. The tables that pertain to this issue are tblOrg, tblState, tblCity, and tblZip. I have posted the table structure with only the pertinant fields...
0
by: matt cupryk | last post by:
I have problems updating the image on the page. <script language="javascript" type="text/javascript"> function pageLoad(sender, args) { $find("cddCountry").add_selectionChanged(onCCSChanged);...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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,...

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.