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

** IE5, IE6 and NETSCAPE COMPATIBILITY PROBLEM **

Good morning all from italy,

i have probably a compatibility problem with a html/javascript page.
The aim of the code of the file test.htm you find here following (copy the
3 files in the
same directory) is to change the content of a layer, created with the
<div...> tag, with an external text (clicking over an hiperlink) or with the
result of a <form...> submition. The solution (I haven't been able to find
anyone else) is to use a hidden <iframe...> as temporary container of the
text request or the form aswer, and then take its content with javascript
functions and copy it in the layer. It work, but just with IE 6. I tried
with IE 5, but it doesn't work. It don't know with Netscape. Somebody know
where is the problem and if I can do in a different manner? Thank you very
much,

Federico.
***************
this is the file test.htm
*****************

<!-- saved from url=(0022)http://internet.e-mail -->
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if
((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_setTextOfLayer(objName,x,newText) { //v4.01
if ((obj=MM_findObj(objName))!=null) with (obj)
if (document.layers) {document.write(unescape(newText));
document.close();}
else innerHTML = unescape(newText);
}
function showText(){
theText = window.textFile.document.body.innerHTML;
MM_setTextOfLayer('Layer1','',theText)
}
//-->
</script>
</head>
<html>

<body>
<div id="Layer1" style="position:absolute; left:218px; top:120px;
width:205px; height:134px; z-index:1"></div>
<form>
<iframe id="textFile" name="textFile" style="display:none"
onLoad="showText()"></iframe>
<input type=button value=Hallo onClick="window.textFile.location =
'testo.txt'">
</form>
<form action="script.php" method="post" target="textFile"><input
name="testo" type="text"><input value="submit html test"
type="submit"></form>
<p>&nbsp;</p>
<p onClick="window.textFile.location = 'testo.txt'"><u><font
color="#0000FF">test</font></u>
</p>
</body>
</html>
-----------------------------------

*************************
this is the file script.php
***************************

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="CP_ACP"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<? echo("this is a test: $testo"); ?>
</body>
</html>

----------------------------------------

*****************
this is the file testo.txt
*******************

this is a test file!!!

Jul 20 '05 #1
4 4721

"Federico Bari" <fe********@tiscali.it> wrote in message
news:bj**********@lacerta.tiscalinet.it...
| Good morning all from italy,
|
| i have probably a compatibility problem with a html/javascript page.
| The aim of the code of the file test.htm you find here following (copy
the
| 3 files in the
| same directory) is to change the content of a layer, created with the
| <div...> tag, with an external text (clicking over an hiperlink) or with
the
| result of a <form...> submition. The solution (I haven't been able to find
| anyone else) is to use a hidden <iframe...> as temporary container of the
| text request or the form aswer, and then take its content with javascript
| functions and copy it in the layer. It work, but just with IE 6. I tried
| with IE 5, but it doesn't work. It don't know with Netscape. Somebody know
| where is the problem and if I can do in a different manner? Thank you very
| much,

Will work fine in IE4+ guaranteed. I built a cottage industry out of hidden
IFrames and updating Div's in such a fashion. It can work with NS6/Mozilla
and Opera as well, but may require slight variations in your script. I
don't have the time to wade through all of that. You might post an abridged
version...

|
| Federico.
|
|
| ***************
| this is the file test.htm
| *****************
|
| <!-- saved from url=(0022)http://internet.e-mail -->
| <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
| <html>
| <head>
| <title>Untitled Document</title>
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
| <script language="JavaScript" type="text/JavaScript">
| <!--
| function MM_reloadPage(init) { //reloads the window if Nav4 resized
| if (init==true) with (navigator) {if
| ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
| document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
| onresize=MM_reloadPage; }}
| else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
| location.reload();
| }
| MM_reloadPage(true);
|
| function MM_findObj(n, d) { //v4.01
| var p,i,x; if(!d) d=document;
| if((p=n.indexOf("?"))>0&&parent.frames.length) {
| d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
| if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
| x=d.forms[i][n];
| for(i=0;!x&&d.layers&&i<d.layers.length;i++)
| x=MM_findObj(n,d.layers[i].document);
| if(!x && d.getElementById) x=d.getElementById(n); return x;
| }
|
| function MM_setTextOfLayer(objName,x,newText) { //v4.01
| if ((obj=MM_findObj(objName))!=null) with (obj)
| if (document.layers) {document.write(unescape(newText));
| document.close();}
| else innerHTML = unescape(newText);
| }
| function showText(){
| theText = window.textFile.document.body.innerHTML;
| MM_setTextOfLayer('Layer1','',theText)
| }
| //-->
| </script>
| </head>
| <html>
|
| <body>
| <div id="Layer1" style="position:absolute; left:218px; top:120px;
| width:205px; height:134px; z-index:1"></div>
| <form>
| <iframe id="textFile" name="textFile" style="display:none"
| onLoad="showText()"></iframe>
| <input type=button value=Hallo onClick="window.textFile.location =
| 'testo.txt'">
| </form>
| <form action="script.php" method="post" target="textFile"><input
| name="testo" type="text"><input value="submit html test"
| type="submit"></form>
| <p>&nbsp;</p>
| <p onClick="window.textFile.location = 'testo.txt'"><u><font
| color="#0000FF">test</font></u>
| </p>
| </body>
| </html>
| -----------------------------------
|
|
|
| *************************
| this is the file script.php
| ***************************
|
| <%@LANGUAGE="JAVASCRIPT" CODEPAGE="CP_ACP"%>
| <html>
| <head>
| <title>Untitled Document</title>
| <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
| </head>
|
| <body>
|
| <? echo("this is a test: $testo"); ?>
| </body>
| </html>
|
| ----------------------------------------
|
|
|
| *****************
| this is the file testo.txt
| *******************
|
| this is a test file!!!
|
|
|
|
|
Jul 20 '05 #2
hank you ... i supposed iframe was supported by IE4+ ... but that html code
doesn't work with IE5, as i tried in 2 PC just this morning!!! So maybe it
could be a javascript problem with IE5??
Jul 20 '05 #3

"Federico Bari" <fe********@tiscali.it> wrote in message
news:bj**********@lacerta.tiscalinet.it...
| hank you ... i supposed iframe was supported by IE4+ ... but that html
code

our welcome. Yes it is.

| doesn't work with IE5, as i tried in 2 PC just this morning!!! So maybe it

Problem with the code!

| could be a javascript problem with IE5??
|
|

Er. A javascript problem with you script that happens to break IE5. Yes.
I think you have a handle on it. Lets see what you've got here...

Good morning all from italy,

i have probably a compatibility problem with a html/javascript page.
The aim of the code of the file test.htm you find here following (copy the
3 files in the
same directory) is to change the content of a layer, created with the
<div...> tag, with an external text (clicking over an hiperlink) or with the
result of a <form...> submition. The solution (I haven't been able to find
anyone else) is to use a hidden <iframe...> as temporary container of the
text request or the form aswer, and then take its content with javascript
functions and copy it in the layer. It work, but just with IE 6. I tried
with IE 5, but it doesn't work. It don't know with Netscape. Somebody know
where is the problem and if I can do in a different manner? Thank you very
much,

Federico.
***************
this is the file test.htm
*****************

<!-- saved from url=(0022)http://internet.e-mail -->
<%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if
((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++)
x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_setTextOfLayer(objName,x,newText) { //v4.01
if ((obj=MM_findObj(objName))!=null) with (obj)
if (document.layers) {document.write(unescape(newText));
document.close();}
else innerHTML = unescape(newText);
}
function showText(){
theText = window.textFile.document.body.innerHTML;
MM_setTextOfLayer('Layer1','',theText)
}
//-->
</script>
Note 1. MM spells MacroMedia (and big trouble)

Lord this stuff is from Adobe GoLive! (or similar ilk) I would scrap all of
this code to start with...

</head>
<html>

<body>
<div id="Layer1" style="position:absolute; left:218px; top:120px;
width:205px; height:134px; z-index:1"></div>

Note 2. z-index? Needed?

Why the z-index spec. on the first element on the page?

<form>
<iframe id="textFile" name="textFile" style="display:none"
onLoad="showText()"></iframe>
<input type=button value=Hallo onClick="window.textFile.location
='testo.txt'">

Note 3. This could be the problem!

window.textFile? That's not right. You want to use location.replace
anyway.

if (document.getElementById)
getElement = new Function("id", "return document.getElementById(id)")
else if (document.all)
getElement = new Function("id", "return document.all[id]")

var e = getElement("textFile")

if (e.location.replace)
e.location.replace("testo.txt");
else
e.location.href = "testo.txt"

</form>
<form action="script.php" method="post" target="textFile"><input
name="testo" type="text"><input value="submit html test"
type="submit"></form>

Note 4. Mozilla, Netscape, Opera and others will open new windows when this
form is posted. Assign the target programmatically only after determining
that it is IE4+, You could use the IE conditional comments to handle IE5+
with a default of checking for (document.all && !document.getElementById)
to handle IE4.

<p>&nbsp;</p>

Note 5. I really hate to see stuff like this.

<p onClick="window.textFile.location = 'testo.txt'"><u><font
color="#0000FF">test</font></u></p>
Note 6. WTF!

No no no no no no no no. What's all this then? Where to start? How about:

<p><script type="text/javascript">document.write("<a onclick='changeThe
Location()'>test<\/a>")</script></p>

where changeTheLocation is a function that executes the previous example
code about changing the Iframe location.

</body>
</html>
^^^
This is okay.

*************************
*************************
this is the file script.php
***************************
Which seems to do nothing. Doesn't matter at this point though.

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="CP_ACP"%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<? echo("this is a test: $testo"); ?>
</body>
</html>

----------------------------------------

*****************
this is the file testo.txt
*******************

this is a test file!!!
What is this one for? Your php script should output javascript that updates
elements on its parent page.

Jul 20 '05 #4
thank you all! Will try your suggestions! ^_^

Federico.
Jul 20 '05 #5

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

Similar topics

6
by: 2obvious | last post by:
This is a pipe dream, I realize, but I'm trying to emulate the functionality of the W3C DOM-supported document.getElementsByTagName method under the very nightmarish Netscape 4. Through some...
11
by: Jon | last post by:
Hi, I have a function that uses the following line: var level = document.getElementById( id); I also know the name of the element I am looking for. In Netscape Communicator 4.7, however,...
13
by: kaeli | last post by:
Can anyone explain this to me? It's driving me insane. Save this and run it in IE or Opera and then in Mozilla or Netscape 6+. In IE/Opera, I get the expected 4 alerts. In Mozilla/Netscape, I...
26
by: Roger Desparois | last post by:
Hi, I need help : I found the simplest and most precise way to open and close submenu layers. it works perfectly with IE, but for some odd reason NS won't recognize it. Can anyone tell me why...
3
by: Don | last post by:
I can successfully force submission of a <form> using "document.formname.submit()". But, the submission doesn't appear to occur when used with Netscape. Anybody know why this is happening, and...
3
by: VK | last post by:
<http://browser.netscape.com/ns8/> The biggest hecs: Two totally separate, including scripting, parsing engines: Mozilla/Firefox (called "Netscape") and Internet Explorer. User can choose any...
11
by: Kristoffer Arfvidson | last post by:
HI! I have a question.... when designing asp.net pages in vs.net I always see that labels are transformed to <span tags... I stopped using span and div before because of its lack of compatibility...
1
by: MLibby | last post by:
I'm a Netscape newbie and am using it for backward compatibility testing. How do I debug javascript in Netscape? I set Netscape as the default debugger (design mode | file | Browse With) and I am...
2
by: Ashwini Khanna | last post by:
Hi Everybody! I have a browser compability issue with ASP.NET pages. I have created a small web-site in ASP.NET, tested it with IE - all was well till then. Then my client required me to test on...
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: 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...
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
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
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...
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,...
0
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...

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.