By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,570 Members | 1,223 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,570 IT Pros & Developers. It's quick & easy.

Embedding and Printing XHTML

P: n/a
Hi,

I'm trying to set up a webpage so that I can view multiple HTML files
from the same page. For example, you might go to
http://example.com/lab_tests.html and be able to view lab1.html,
lab2.html, and lab3.html right on that page. If you're viewing this
message w/a monospace font, the page layout might look like this:

+-------------------+
| Header | * Code for Header and
+------+------------+ Menu located in
| | | `lab_tests.html'.
| Menu | Lab Report |
| | | * Code for Lab Report
+------+------------+ in `lab2.html'.

I have two questions for the readers of this newsgroup:

(1) What are my options for embedding `lab#.html' into the page, if I
don't want to use frames? (I'm using XHTML 1.0 Strict.) I know I can
use the `object' element. Is there a way I can use JavaScript to read
the innerHTML of `lab#.html' from `lab_tests.html'? (Naturally the
method I use here will complicate my second question.)

(2) Once I put this page together, is there a way I could set up a way
to print just the Lab Report from the main page? I don't know how to
do this if I embed the report in an `object' element. If I could use
JavaScript to read the innerHTML of a separate lab file and add it to
the DOM of the main page, perhaps I could use a media="print"
stylesheet to display only the report.

Ideas?

Alan

Jul 23 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
"Alan Lue" <al*****@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Hi,

I'm trying to set up a webpage so that I can view multiple HTML files
from the same page. For example, you might go to
http://example.com/lab_tests.html and be able to view lab1.html,
lab2.html, and lab3.html right on that page. If you're viewing this
message w/a monospace font, the page layout might look like this:

+-------------------+
| Header | * Code for Header and
+------+------------+ Menu located in
| | | `lab_tests.html'.
| Menu | Lab Report |
| | | * Code for Lab Report
+------+------------+ in `lab2.html'.

I have two questions for the readers of this newsgroup:

(1) What are my options for embedding `lab#.html' into the page, if I
don't want to use frames? (I'm using XHTML 1.0 Strict.) I know I can
use the `object' element. Is there a way I can use JavaScript to read
the innerHTML of `lab#.html' from `lab_tests.html'? (Naturally the
method I use here will complicate my second question.)

(2) Once I put this page together, is there a way I could set up a way
to print just the Lab Report from the main page? I don't know how to
do this if I embed the report in an `object' element. If I could use
JavaScript to read the innerHTML of a separate lab file and add it to
the DOM of the main page, perhaps I could use a media="print"
stylesheet to display only the report.

Ideas?

Alan


Here's something like it that uses iframes.

It displays 3 across using the "site" array.

<html>
<head>
<title>Sites.htm</title>
<script type="text/javascript">
var site = new Array();
site[1] = "http://www.domain1.com";
site[2] = "http://www.domain2.com";
site[3] = "http://www.domain3.com";
site[4] = "http://www.domain4.com";
site[5] = "http://www.domain5.com";
site[6] = "http://www.domain6.com";
var ifra = "' style='width:320; height:120' frameborder='1'";
ifra += " marginwidth='0' marginheight='0' scrolling='yes'></iframe>\n";
var html = "<table border='0' width='980'>\n";
html += "<tr>\n";
for (var i=1; i<site.length; i++) {
html += " <th height='150'>\n";
html += " <iframe src='" + site[i] + ifra;
html += " <br><a href='" + site[i] + "' target='_blank'>" +
site[i].substr(11) + "</a>\n";
html += " </th>\n";
if (i % 3 == 0) {
html += "</tr>\n";
html += "<tr>\n";
}
}
html += "</tr>\n";
html += "</table>\n";
document.write(html);
</script>
</head>
<body margintop="0" marginleft="0">
</body>
</html>
Jul 23 '05 #2

P: n/a
McKirahan wrote:
"Alan Lue" <al*****@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
[...]
(1) What are my options for embedding `lab#.html' into the page, if I
don't want to use frames? (I'm using XHTML 1.0 Strict.) I know I can

[...]
Here's something like it that uses iframes.


If the OP specifically requests *not* frames, why suggest
frames?

You can't use iframes with XHTML 1.0 strict and have it pass
validation. XHTML Transitional might suit, or the OP can create
a custom DTD and do whatever.

--
Zif
Jul 23 '05 #3

P: n/a
Right, right, right; well said. I'm trying to do this without frames.

I guess I'm wondering whether it's possible to use CSS to style and
display a JavaScript-modified DOM.

The other thing I want to know is if there's some way I can use
JavaScript to read a separate HTML file into the current one. I
suspect that I'll need to use something else in conjunction... maybe
Java or something.

Anyway, I'd appreciate any insight.

Thanks,
Alan

Jul 23 '05 #4

P: n/a
"Zifud" <Zi***@hotmail.com> wrote in message
news:Ci****************@news.optus.net.au...
McKirahan wrote:
"Alan Lue" <al*****@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...

[...]
(1) What are my options for embedding `lab#.html' into the page, if I
don't want to use frames? (I'm using XHTML 1.0 Strict.) I know I can

[...]
Here's something like it that uses iframes.


If the OP specifically requests *not* frames, why suggest
frames?


[snip]

iframes <> frames
Jul 23 '05 #5

P: n/a
"Zifud" <Zi***@hotmail.com> wrote in message
news:Ci****************@news.optus.net.au...
McKirahan wrote:
"Alan Lue" <al*****@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...

[...]
(1) What are my options for embedding `lab#.html' into the page, if I
don't want to use frames? (I'm using XHTML 1.0 Strict.) I know I can

[...]
Here's something like it that uses iframes.


If the OP specifically requests *not* frames, why suggest
frames?


[snip]

iframes != frames
Jul 23 '05 #6

P: n/a
Sorry McKirahan; you're right abt that, though iframes won't solve the
problem. They're part of XHTML Transitional but not Strict.

Alan

Jul 23 '05 #7

P: n/a
If you are using "strict" isn't there an xml declaration at the top of
the page?

If there IS, then couldn't you read the pages as XML using the IE
ActiveX and mozilla xmlhttprequest objects to retrieve the pages with
javascript?

If that could work, then you would just have to parse the document tree
and get all the nodes that you need to display the content.

Haven't tried it, just an idea.

Jul 23 '05 #8

P: n/a
Alan Lue wrote:
Sorry McKirahan; you're right abt that, though iframes won't solve the
problem. They're part of XHTML Transitional but not Strict.


And, in the long term, not part of XHTML at all, since 1.1 and 2.0 are
Strict only.

---
John W. Kennedy
"Only an idiot fights a war on two fronts. Only the heir to the throne
of the kingdom of idiots would fight a war on twelve fronts"
-- J. Michael Straczynski. "Babylon 5", "Ceremonies of Light and Dark"
Jul 23 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.