473,396 Members | 2,002 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,396 software developers and data experts.

Can't replace the body element in IE.

I have been trying to dynamically push a page to frameset with the following code:
  1. No frames page can be hosted on the pages source domain
  2. No external domain is permitted to host a frameset either from this site.

Expand|Select|Wrap|Line Numbers
  1. function enframe(topURL, bottomURL){
  2.     var topFrame = document.createElement("FRAME");
  3.     topFrame.name = "topFrame";
  4.     topFrame.src = topURL;
  5.  
  6.     var  bottomFrame = document.createElement("FRAME");
  7.     bottomFrame.name = "bottomFrame";
  8.     bottomFrame.src = bottomURL;
  9.  
  10.     var frameset = document.createElement("FRAMESET");
  11.     frameset.rows = "205,*";
  12.     frameset.cols = "*";
  13.     frameset.frameborder="no";
  14.     frameset.framespacing="0";
  15.     frameset.border="0";
  16.     document.body = frameset;
  17.     frameset.appendChild(topFrame);
  18.     frameset.appendChild(bottomFrame);
  19. }
IE chokes on this code with a "htmlpage: Member not found" error while firefox is happy as a clam.

This yields two questions:
  • Is IE document.body parameter read-only?
  • What can be done in IE to replace the HTMLBodyElement with a FRAMESET element in a loaded document?

Any ideas?
Dec 22 '06 #1
1 2703
The only way I can think of doing it is by determining if the browser is IE or another and using document.write if it is IE:


<body>
<script language="javascript">
function enframe(topURL, bottomURL){
if (navigator.appName == "Microsoft Internet Explorer"){document.write("<frameset rows='205,*' cols='*' frameborder='no' framespacing='0' border='0'><frame name='topFrame' src="+topURL+"><frame name='bottomFrame' src="+bottomURL+"></frameset>");}
else

var topFrame = document.createElement("FRAME");
topFrame.name = "topFrame";
topFrame.src = topURL;

var bottomFrame = document.createElement("FRAME");
bottomFrame.name = "bottomFrame";
bottomFrame.src = bottomURL;

var frameset = document.createElement("FRAMESET");
frameset.rows = "205,*";
frameset.cols = "*";
frameset.frameborder="no";
frameset.framespacing="0";
frameset.border="0";
document.body= frameset;
frameset.appendChild(topFrame);
frameset.appendChild(bottomFrame);

}

</script>

<a href="javascript:enframe('http://www.google.com','http://www.yahoo.com')">Go To Frame</a>
</body>
Dec 23 '06 #2

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

Similar topics

3
by: Miguel J. Jiménez | last post by:
Hi, I have the following node: <node> Some text here with lots of inside it... </node> and I would like it to transfrom it using XSLT to the following: Some text<br/> here with</br> lots...
5
by: Patient Guy | last post by:
In my reading of the Strict and Transitional DTD for HTML 4.0, the table row (TR) elements are contained within table section elements: THEAD, TFOOT, and TBODY. The table section elements are...
9
by: Jean Pierre Daviau | last post by:
Hi everybody, I have this function in a page (namely cours.html) function go(inValue) { var lien = 'file:///F:/MyWebs/jeanpierredaviaucom/httpdocs/cours1.html?T1=' + document.R.T1.value;
0
by: DotDidIt | last post by:
Hi Everybody! I developed a Web service with IBM RAD v 6.0.1. After creating the WSDL file i have tried to develop a .Net client. But by using wsdl.exe (1.1.4322) to create a .net c# proxy i...
3
by: gregpinero | last post by:
Hi guys, What I'm trying to do is find all instances of an acronymn such as IBM on a webpage and replace it with <acronym title="International Business Machines">IBM</acronym>. However in my...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
11
by: Fabri | last post by:
I searched and tried to develop (with no luck) a function to do the following: I have a string that may be: "Le'ts go to <a href="my.htm">my car</a>. Tomorrow I'll have to buy a new car. My...
28
by: Wladimir Borsov | last post by:
The HTML source of one of my web pages starts simplified with a code like: ---- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> ..... <BODY BACKGROUND="images/myback.gif"> <div...
3
by: jackson.rayne | last post by:
Hello, Another newbie question here. Let me explain my situation first. I have bought a 3rd party tool that runs a PHP script and gives me some HTML code which I can directly use in my...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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...
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.