473,836 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with IE when I use frames[rte].document?

Hi

I have tried the following code. It works in Mozilla. In IE I'm not able to
enable DesignMode? What have I done wrong? It says that obj is undefined?
Can anyone help me please.



<html>

<head>

<script type="text/javascript">

function initRTE (html, width, height) {

this.html = html;

this.width = width;

this.height = height;

}

initRTE.prototy pe.makeRTE = function() {

document.writel n('<iframe src="blank.htm" id="rte1" name="rte1" width="' +
this.width + 'px" height="' + this.height + 'px"></iframe>');

alert("getEleme ntById: " + document.getEle mentById('rte1' ));

this.enableDesi gnMode("rte1", this.html);

}

initRTE.prototy pe.enableDesign Mode = function(rte, html) {

alert("enableDe signMode getElementById: " +
document.getEle mentById('rte1' ));

var frameHtml = "<html>\n";

frameHtml += "<head>\n";

frameHtml += "</head>\n";

frameHtml += "<body>\n";

frameHtml += html + "\n";

frameHtml += "</body>\n";

frameHtml += "</html>";

if (document.all) {

var obj = frames[rte].document;

alert("obj " + obj);

obj.open();

obj.write(frame Html);

obj.close();

obj.designMode = "on";

} else {

try {

document.getEle mentById(rte).c ontentDocument. designMode = "on";

try {

obj =
document.getEle mentById(rte).c ontentWindow.do cument;

obj.open();

obj.write(frame Html);

obj.close();

} catch (e) {

}

} catch (e) {

}

}

}

</script>

</head>

<body>

<form name="form" action="" method="get">

<script language="JavaS cript" type="text/javascript">

// initRTE (html, width, height)

var rte1 = new initRTE ("Just some text....", 560, 200);

rte1.makeRTE();

</script>

</form>

</body>

</html>

Thanks for any help!

Jan Ebbe Jensen
Jul 23 '05 #1
3 2453
I just want to let you know that it is not a good idea to use frames. They
are deprecated, and also have some small security issues. They are also not
supported by all browsers and some older versions of certain browsers do not
always render them correctly. If you really need to combine multiple
documents, I would suggest using Server-Side Includes (the name may sound
scary, but they are really quite easy) and layout the page with tables. If
you are dynamically changing the content of a frame using Javascript and
don't want to learn a new complicated technology, I would suggest looking
into ASP (not ASP.NET, ASP.NET is much more complicated). But as useful as
frames may seem, they can be very dangerous, and are not usually worth using
a deprecated technology.
--
Nathan Sokalski
nj********@hotm ail.com
http://www.nathansokalski.com/

"Jan Ebbe Jensen" <ja*****@tdcads l.dk> wrote in message
news:42******** *************@d read11.news.tel e.dk...
Hi

I have tried the following code. It works in Mozilla. In IE I'm not able
to enable DesignMode? What have I done wrong? It says that obj is
undefined? Can anyone help me please.



<html>

<head>

<script type="text/javascript">

function initRTE (html, width, height) {

this.html = html;

this.width = width;

this.height = height;

}

initRTE.prototy pe.makeRTE = function() {

document.writel n('<iframe src="blank.htm" id="rte1" name="rte1" width="'
+ this.width + 'px" height="' + this.height + 'px"></iframe>');

alert("getEleme ntById: " + document.getEle mentById('rte1' ));

this.enableDesi gnMode("rte1", this.html);

}

initRTE.prototy pe.enableDesign Mode = function(rte, html) {

alert("enableDe signMode getElementById: " +
document.getEle mentById('rte1' ));

var frameHtml = "<html>\n";

frameHtml += "<head>\n";

frameHtml += "</head>\n";

frameHtml += "<body>\n";

frameHtml += html + "\n";

frameHtml += "</body>\n";

frameHtml += "</html>";

if (document.all) {

var obj = frames[rte].document;

alert("obj " + obj);

obj.open();

obj.write(frame Html);

obj.close();

obj.designMode = "on";

} else {

try {

document.getEle mentById(rte).c ontentDocument. designMode = "on";

try {

obj =
document.getEle mentById(rte).c ontentWindow.do cument;

obj.open();

obj.write(frame Html);

obj.close();

} catch (e) {

}

} catch (e) {

}

}

}

</script>

</head>

<body>

<form name="form" action="" method="get">

<script language="JavaS cript" type="text/javascript">

// initRTE (html, width, height)

var rte1 = new initRTE ("Just some text....", 560, 200);

rte1.makeRTE();

</script>

</form>

</body>

</html>

Thanks for any help!

Jan Ebbe Jensen

Jul 23 '05 #2
JRS: In article <GOtfe.3933$nX1 .1593@trnddc09> , dated Sun, 8 May 2005
19:31:50, seen in news:comp.lang. javascript, Nathan Sokalski
<nj********@ver izon.net> posted :

Please do not over-quote.

Please do not top-post.

Please do not put a signature separator in the middle of a message.

Please read the newsgroup FAQ.
I just want to let you know that it is not a good idea to use frames. They
are deprecated, and also have some small security issues. They are also not
supported by all browsers and some older versions of certain browsers do not
always render them correctly.
Security apart, those are not good reasons not to have frames; they are
only good reasons for not relying on using frames.

A site designed for use without frames can, with little effort, have
indexing frames as a reader-selected option.

Indeed, since screens and viewports vary in width, a wide-view reader
who has chosen to see the framed view can have a normal-view window
showing the main material, with a site-navigation frame, or frames,
added on the left as a scrollable column.
My pages have a "Frame This" link near the top; users with javascript
and frames will (AFAIK, in all browsers) then get the page framed, while
others will get a suitable response. They also have a "No-Frame" link.

"Jan Ebbe Jensen" <ja*****@tdcads l.dk> wrote in message
news:42******* **************@ dread11.news.te le.dk...
Hi

... ... ...


--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.c om/faq/> JL/RC: FAQ of news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
Jul 23 '05 #3
Nathan Sokalski wrote:
I just want to let you know that it is not a good idea to use frames.
Even though your intention is valid, your argumentation is badly flawed:
They are deprecated,
They have been deprecated by some W3C guys (without endorsement by all
members) since the time of XHTML 1.0. The same W3C guys recommend to
use client-side scripting instead of the `target' attribute, ignoring
that client-side scripting is not in the half of the cases available
that frame support is today. Not a good reason.
and also have some small security issues.
Not a good reason. There are much more security issues not related to
frames than related to them.
They are also not supported by all browsers
Not a good reason and not a problem, as those browsers (have to) provide
alternatives to access frame content. E.g. `lynx' as a text-only browser
does not support frames (even though `links' which also is a text-only
browser does), displays frame references as links.
and some older versions of certain browsers do not always render them
correctly.
At first you argue that they are deprecated (which applies for recent user
agents) and then you argue that older (!recent) user agents don't support
them properly. That's a contradiction. Furthermore, in that case those
older user agents are borken and do not require nor do they deserve support
from a reasonable Web author/programmer.
f you really need to combine multiple documents, I would suggest using
Server-Side Includes (the name may sound scary, but they are really quite
easy)
But that would increase server load and it would increase bandwidth usage
compared to a site built on frames.
and layout the page with tables.
Certainly not. Tables are for tabular data, not for layout:
A table is a table is a table. [psf 3.8] (Learn to) use CSS instead.
If you are dynamically changing the content of a frame using Javascript
and don't want to learn a new complicated technology, I would
suggest looking into ASP (not ASP.NET, ASP.NET is much more complicated).
That would be (Microsoft) JScript, not (Netscape) Java[sS]cript.
But as useful as frames may seem, they can be very dangerous, and are
not usually worth using a deprecated technology.


A good reason for using frames is usability. It makes a Web site less
usable to have all content reloaded if only a short portion of that
changes. Time is money.

A good reason for *not* using frames is usability. It is harder to
bookmark specific content on a Web site when it is built on frames.

But no such good reason for or against frames has been presented by you,
which makes me wonder whether you gave or your argumentation not enough
thought or just copy-pasted it without thought from someone/-where.
PointedEars
--
Bill Gates isn't the devil -- Satan made sure hell
_worked_ before he opened it to the damned ...
Jul 23 '05 #4

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

Similar topics

3
9466
by: Marcus Bjorke | last post by:
I use a print link that causes a problem with Opera 7. The link looks like this <a href="javascript:parent.frames.mainFrame.print()">Print this page</a> I also used <a href="javascript:print()">Print this page</a> and it also worked with most browsers. I realize that it only works if you have Microsoft Windows versions for PC but that is what most of out customers have anyway. I have also noticed that there is a problem
1
2999
by: kuok benny | last post by:
Hi, I am trying to use the document.referrer to get the referrer of my home page. Occationally, I get the value of 'blockedReferrer'. Actually how this happen, how the client blocked the function of document.referrer. I just want to verify how this could be done within the browser e.g. IE, Netcape and so on... what Internet option have them activate or not activate to make me to have the value 'blockedReferrer'? Thanks in advance.
4
2695
by: meehirjha1 | last post by:
Hello, can any body help me out.. I have some td element which have following ids ctl1_lnkPrint ctl2_lnkPrint ctl3_lnkPrint ctl4_lnkPrint ctl5_lnkPrint ... ...
8
52832
by: Henrik Stidsen | last post by:
I am trying to access a table in an iframe via javascript. It sounds easy - but it won´t work... The iframe is added to the document via someContainerElement.innerHTML = "<iframe...>", it has name and ID and its visible in my DOM explorer just as the table I need is it. The table is added from ASP.NET via Response.Write(). I have tried both window.frames, document.getElementById and even document.getElementsByTagName, nothing has...
4
3127
by: pbreah | last post by:
I'm doing a Rich Text Editor (WYSIWYG) in javascript for a game for kids. I'm doing a special case in with every keystroke from A-Z creates a background and foreground color for that letter, witch is the same. The problem is editing doesn't work that well. For example when I type: ABCDFG , I get this code generated and displayed by the Rich Text Editor: <P><FONT style="BACKGROUND-COLOR: #ffff00" color=#ffff00>a<FONT...
2
2691
by: Smugsboy | last post by:
Hi, Got a problem here. I'm trying to create a bookmarklet on IE6, that passes the outerHTML of the body element as a GET param my site. The problem is that for some page (ie mail.yahoo.com) the bookmarklet does not work while for other pages (simpler ones) it does work. Any idea ? Can it be something regarding size of GET param ? Thanks,
0
821
by: =?Utf-8?B?TWlubmll?= | last post by:
It's me again. First, I'd like to thank Pete for his help. For some reason I could not post a reply to my last question. Anyway......... I am lost with the project I have to do. It seems like I don't know any of the functions relative to this project. My next question is: How do I get the date in a cell to automatically appear when my excel document is opened? Your help is always appreciated!
1
6517
by: raviviswanathan.81 | last post by:
Hello, So we have a webmaster who sets document.domain to some domain. After that, we try to create and inject text inside an iframe by getting the iframeID.contentDocument (or iframeID.contentWindow.document for MSIE). This results in an 'access denied' issue in MSIE (No problem in Mozilla). Note that if there is document.domain initialization before this iframe creation/content injection, there is no problem and all works well.
10
3459
by: waltapp | last post by:
Hello, I am a new programmer and I am working on a school project. I am being instructed to move up then down the dom. My parent is demo.html then a frameset and then another frameset within the frameset. I have figured out how to get up to the parent and then down to the first frameset and change the rows attribute. However I am stuck on getting to the next level, I am required to change the height of the second frameset textarea to 300 pixels....
0
9671
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
10852
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
10553
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
10255
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9382
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
6980
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
5651
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...
2
4021
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3116
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.