473,770 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Inject XML into iframe along with styling

Samji
23 New Member
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 3913
acoder
16,027 Recognized Expert Moderator MVP
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 New Member
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 New Member
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 New Member
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
21117
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 that more info fits in the text box, but i'm not too savvy in html, and the <font> tag doesn't seem to work here. does anyone know how to change the size (and if possible also the font) of the file (reverse-swatch.txt) that is loaded in the iframe...
1
5537
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? Thanks, - Olumide
2
2423
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 form fields which contain the results of a database query. I need to be able to submit the form and have the fields in the IFRAME submitted along with it. Is there a way to do this with javascript?
3
1835
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 ok then whe whole page redirect to a url if not an error code is showed on the page how do I do this? I am really confused?!?!
13
6714
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 getting as far as the iframe section as other parts of the html code work correctly. But it is not executing any code within the getPage() function as some "hello world" writes within getPage() wouldn't print. ...
10
3860
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 method that initially copies all the original page's styles onto the new iframe to maintain look and feel. So far things work, and the div (along with look and feel from styles) are successfully copied to the iframe and printing just the hidden...
4
32175
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 and just read object's values? This is what I've tried so far without any success: document.getElementsByTagName("iframe").contentWindow; document.getElementsByTagName("iframe").innerHTML;
2
3644
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"> The problem is, when any of these links is clicked, along with the iframe, the parent page scrolls up too to the beginning of the iframe.
5
5143
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 server. So mydomain.com is in the browser address bar and loads PageA (from Mydomain2.com). Page A contains a form and a submit button. I need to Inject some data from the Db into one or several fields contained in the Form on PageA. And...
0
9454
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
10257
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
10099
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...
0
8931
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...
0
6710
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();...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2849
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.