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

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.prototype.makeRTE = function() {

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

alert("getElementById: " + document.getElementById('rte1'));

this.enableDesignMode("rte1", this.html);

}

initRTE.prototype.enableDesignMode = function(rte, html) {

alert("enableDesignMode getElementById: " +
document.getElementById('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(frameHtml);

obj.close();

obj.designMode = "on";

} else {

try {

document.getElementById(rte).contentDocument.desig nMode = "on";

try {

obj =
document.getElementById(rte).contentWindow.documen t;

obj.open();

obj.write(frameHtml);

obj.close();

} catch (e) {

}

} catch (e) {

}

}

}

</script>

</head>

<body>

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

<script language="JavaScript" 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 2419
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********@hotmail.com
http://www.nathansokalski.com/

"Jan Ebbe Jensen" <ja*****@tdcadsl.dk> wrote in message
news:42*********************@dread11.news.tele.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.prototype.makeRTE = function() {

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

alert("getElementById: " + document.getElementById('rte1'));

this.enableDesignMode("rte1", this.html);

}

initRTE.prototype.enableDesignMode = function(rte, html) {

alert("enableDesignMode getElementById: " +
document.getElementById('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(frameHtml);

obj.close();

obj.designMode = "on";

} else {

try {

document.getElementById(rte).contentDocument.desig nMode = "on";

try {

obj =
document.getElementById(rte).contentWindow.documen t;

obj.open();

obj.write(frameHtml);

obj.close();

} catch (e) {

}

} catch (e) {

}

}

}

</script>

</head>

<body>

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

<script language="JavaScript" 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********@verizon.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*****@tdcadsl.dk> wrote in message
news:42*********************@dread11.news.tele.dk ...
Hi

... ... ...


--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.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
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...
1
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...
4
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
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...
4
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...
2
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...
0
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...
1
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...
10
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.