473,508 Members | 2,250 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Why does this not work in IE, but in Mozilla (and compatible)

I have the following (seemingly) useless piece of JavaScript

<html>
<head>

<script type="text/javascript">
function frameMe() {
s = "document.open();";
s += "document.writeln('<html><frameset rows=\"*,33%\">');\n";
s += "document.writeln('<frame src=\"' + document.location +
'\">');\n";
s += "document.writeln('<frame src=\"about:blank\">');\n";
s += "document.writeln('</frameset></html>');\n";
eval(s);
}
</script>

</head>

<body>
<input type="button" onClick="frameMe();" value="Frame me! (again?)">
</body>
</html>

Now, in Firefox this works fine, but in IE, it doesn't. Does anyone
know why, and if it can be helped?

Thanks,
Vincent
Jul 23 '05 #1
2 1461


Vincent van Beveren wrote:

<html>
<head>

<script type="text/javascript">
function frameMe() {
s = "document.open();";
s += "document.writeln('<html><frameset rows=\"*,33%\">');\n";
s += "document.writeln('<frame src=\"' + document.location +
'\">');\n";
s += "document.writeln('<frame src=\"about:blank\">');\n";
s += "document.writeln('</frameset></html>');\n";
Why no
document.close();
call?
eval(s);
Why the eval, couldn't you simply have the function have
document.open();
document.write(...);
document.close();
calls?
</script>

</head>

<body>
<input type="button" onClick="frameMe();" value="Frame me! (again?)">
</body>
</html>

Now, in Firefox this works fine, but in IE, it doesn't.


Well what happens with IE, do you get a script error, or what exactly
doesn't work?


--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Vincent van Beveren wrote:
I have the following (seemingly) useless piece of JavaScript

<html>
<head>

<script type="text/javascript">
function frameMe() {
s = "document.open();";
s += "document.writeln('<html><frameset rows=\"*,33%\">');\n"; s += "document.writeln('<frame src=\"' + document.location +
'\">');\n";
s += "document.writeln('<frame src=\"about:blank\">');\n";
s += "document.writeln('</frameset></html>');\n";
eval(s);
}
</script>

</head>

<body>
<input type="button" onClick="frameMe();" value="Frame me! (again?)">
</body>
</html>

Now, in Firefox this works fine, but in IE, it doesn't. Does anyone
know why, and if it can be helped?

Thanks,
Vincent

Vincent,
Hmm...thats kinda neat....never thought of dynamically writing frames,
but it does seem to work. I worked out a way that works for firefox
and IE (see below). I tend to not like using frames since there are
usually other ways to do it without...but if you have some strange need
it could come in handy(I myself might have such a need). Eric

<html>
<head>

<script type="text/javascript">

function frameMe() {
document.write('<html><frameset rows=\"*,33%\"><frame name=\"main\"
src=\"net.htm\"><frame src=\"testme

..htm\"></frameset></html>');
window.frames.main.location="net.htm"
}
</script>

</head>

<body>
<input type="button" onClick="frameMe();" value="Frame me! (again?)">
</body>
</html>

Jul 23 '05 #3

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

Similar topics

2
3643
by: rnd | last post by:
Hi all! could you kindly help me to solve a compatibility problem that involves Internet Explorer and NN/Mozilla. I created a html page that contains a form (its name is "Modulo") and some...
8
2907
by: Nicolás Lichtmaier | last post by:
Hi, some time ago I've written an article about this issue. It explain some differences in Explorer's and Mozilla's JavaScript/DOM. It has recently changed its URL, This is the new one: ...
2
3477
by: mark4asp | last post by:
Why does this not work in Mozilla ? <http://homepage.ntlworld.com/mark.pawelek/code/animals.html> The optHabitat_change() event does not fire. What am I doing wrong here? PS: It should...
2
1697
by: Aaron | last post by:
how can i make this compatible with Mozilla/Firefox or netscape? <span id="id1" onmouseover="id1.style.display = 'none'">dfdfd</span> the word disappears with mouse over in IE. Thanks
2
8177
by: James_patageul | last post by:
Hello people i would like to know what mean Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1) so what browser it is and what OS it is thank a lot...
2
2121
by: Brett | last post by:
If you paste the URL used in this code into a browser, it will render without errors. Running the code puts it in the Catch with a Time out error but not always. I have ran both (see link below...
4
7710
by: th1421 | last post by:
Hi, I'm new to FireFox. I am currently trying to convert my website to be compatible with it. Doing so I’m trying to process some XML/XSLT pages (preferably without using JavaScript). When I...
1
1881
by: mdbrown | last post by:
Hi guys, I have been searching for solutions, but in vain. Hope i'll be able to source for answers here from you guys, thanks in anticipation. I have this application that works fine in IE7,...
2
5549
by: kailashchandra | last post by:
<html> <head> <title>PHP Test</title> </head> <body> <?php echo $_SERVER; ?> </body> </html>
0
7127
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
7331
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
7391
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...
1
7054
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...
1
5056
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4713
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...
0
3204
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...
0
1564
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 ...
1
768
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.