473,569 Members | 2,729 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamically changing html content of an IFRAME

Hi,
I am attempting to load an ad Banner to coincide with a piece of video
pre-roll. The following function is called which is supposed to create
an empty IFRAME. Once this IFRAME object is created javaScript should
then be able to open and write to the IFRAME. The following code seems
to work perfectly in I.E. however in Firefox doesn't want to work. If
anyone can help it would be greatly appreciated.

Thanks
Jeremy

JavaScript Source:

function FLA_HandleEmbed Banner(embedBan ner)
{

var bannerHTML = embedBanner

var adFrame = document.create Element("IFRAME ");
adFrame.setAttr ibute("src", "about:blan k");
adFrame.setAttr ibute("framebor der", 0);
adFrame.style.w idth = 300+"px";
adFrame.style.h eight = 250+"px";
adFrame.id = "bannerIFra me"
adFrame.frameBo rder = 0;
adFrame.scrolla ble = "no";

document.body.a ppendChild(adFr ame);

adFrame.classNa me = "bannerWind ow"

document.frames["bannerIFra me"].document.open( );

document.frames["bannerIFra me"].document.write ("<html><bod y style =
'background-color:#000000;p adding:0px;over flow:hidden;mar gin:0'>"+banner HTML+"</body></html>");
document.frames["bannerIFra me"].document.close ();

}

function destroyEmbededB anner()
{
document.getEle mentById("banne rIFrame").style .visibility =
"hidden"
}

</script>

Dec 11 '06 #1
1 1834
Jeremy wrote:
var adFrame = document.create Element("IFRAME ");
adFrame.id = "bannerIFra me"
Use name and id
adFrame.name = adFrame.id = "bannerIFra me";

document.body.a ppendChild(adFr ame);
document.frames["bannerIFra me"].document.open( );
then cross browser the frame should be found in window.frames
var iframeWin = window.frames["bannerIfra me"], iframeDoc =
iframeWin.docum ent;
iframeDoc.open( );
iframeDoc.write (...);
iframeDoc.close ();
>
document.frames["bannerIFra me"].document.write ("<html><bod y style =
'background-color:#000000;p adding:0px;over flow:hidden;mar gin:0'>"+banner HTML+"</body></html>");
document.frames["bannerIFra me"].document.close ();

}

function destroyEmbededB anner()
{
document.getEle mentById("banne rIFrame").style .visibility =
"hidden"
}

</script>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Dec 11 '06 #2

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

Similar topics

5
4199
by: Jim Marquardson | last post by:
Hi, I've struggled with this for a while now, so I'm asking for help. I am trying to click on a link in one page, have that link open up in a new window, and set that newly opened window's ifram to a specific url. Here is the code I'm using: <html> <head>
5
9739
by: Angel | last post by:
Is there a way to create an IFRAME dynamically via VB.NET. In other words creating the HTML element in the server side code? thanks in advance....
1
14062
by: Anil | last post by:
Hello, In line 8 below, I am trying to set the content of the iframe, but receive an error. Movie 2 plays normally. Movie 1 fails. This example is from the QuickTime docs. (example 1-4)http://developer.apple.com/documentation/QuickTime/Conceptual/QTScripting_JavaScript/index.html Does anyone know what might be the problem? thanks, Anil
3
4975
by: synergy_711 | last post by:
I feel like this should be fairly easy but I have been struggling with this for sometime. I have not been able to find someone who's had the same problem as mine yet. http://g.bach.home.insightbb.com/movies.html I have a page set up on my website to view videos from various sites by creating html pages and creating links to view them...
0
7609
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...
0
7921
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. ...
0
8118
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...
1
7666
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...
0
7964
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
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...
0
5217
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...
0
3651
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...
1
2107
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

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.