473,387 Members | 1,540 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,387 software developers and data experts.

Inject XML into iframe along with styling

Samji
23
Hello everyone.

I am trying to write out the contents of a tag in an XML document to an iframe.
I can do that successfully with the following code...

Expand|Select|Wrap|Line Numbers
  1. function constructMsgBody() 
  2. {
  3.     // constuct message body from "message" tags;
  4.     // write out to iframe on view message dialog
  5.     var message = msgsfile.getElementsByTagName("message")[msg].firstChild.nodeValue;
  6.     var writemsg = parent.frames['msgframe'];
  7.     writemsg.document.open();
  8.     writemsg.document.write(message);
  9.     writemsg.document.close();
  10. }
  11.  
But how can I get the stylesheet (CSS) referenced in the XML document to be applied to what I have injected into the iframe. Do I have to load the line where the stylesheet declaration occurs? This code is for a Firefox extension I am working on.

Thanks in advance.
Jan 24 '07 #1
4 3873
acoder
16,027 Expert Mod 8TB
See the quirksmode page on this and, after that, the howtocreate page (and this) which extends the original script to include other methods including iframes.

Hope that helps.
Jan 25 '07 #2
Samji
23
See the quirksmode page on this and, after that, the howtocreate page (and this) which extends the original script to include other methods including iframes.

Hope that helps.
Thanks. I'll take a look.
Jan 25 '07 #3
Samji
23
Thanks. I'll take a look.
I took a look at those pages and it seems like a lot of extra coding. Is there a way I could just write the whole document out to the iframe and then just hide the contents of the tags I don't want displayed?
Jan 26 '07 #4
Samji
23
Hmmm... maybe I can use this: :D

http://www.htmldog.com/reference/css...es/visibility/
Jan 26 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Tom Van Overbeke | last post by:
Hi, I created a web page that displays a logfile monitor i wrote for monitoring our servers. it refreshes every minute and displays a text file in an iframe. I'd like to reduce the font size so...
1
by: 50295 | last post by:
Hi! I'm trying to set the align property/attribute of an IFrame to center but its not working (see below). Can anyone please tell me what's going on, and if there's a work around for this? ...
2
by: Targa | last post by:
Not sure if this is the correct group for this but I assume this can be done with javascript. Basically, I have a page with a form on it. There is also an IFRAME on the page that has several...
3
by: cevatkerim | last post by:
Ok simple project! a login page with a hidden iframe when u click on submit after inserting your user and pass it pushes those values to iframe and asp query the db and returns a code if it is...
13
by: ukrbend | last post by:
I'm new to Javascript and to html and am trying to make the following code snippet work but it doesn't. It refuses to call the getPage() function and I always get a 404 error. I know the code is...
10
by: jon | last post by:
I'm trying to use a hidden iframe to print the contents of one div seamlessly. Currently I can create the hidden iframe, copy the contents of the div to the iframe, and print it. I even have a...
4
by: Yansky | last post by:
Is it possible to read the DOM of an iframe if the iframe's src is from another domain? I realise I can't manipulate the DOM from another domain for security reasons, but can I access the DOM...
2
by: knkk | last post by:
I have an iframe in a page (with a name to the iframe), and in that iframe I have several anchors <a name="something"> There are links in the iframe that look like <a href="#something"> ...
5
by: jeffos101 | last post by:
Hi, I am trying to do the following and would like to know if it's possible using Javascript/Ajax/and some DB I have an Iframe hosted on one server that loads a page which is located on another...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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...

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.