...

View Full Version : Works in IE 6 but not 5.2 or Firefox



petey20
03-14-2005, 05:04 PM
I have this online editor that works like a charm in IE 6 but it is not working correctly in I.E. 5.2 or the latest Firefox. I'm getting a couple errors in the Java Consol in firefox which I'm assuming is the problem. Would anyone be interested in helping me debug this? I'm spinning my wheels on this big time.

On of the errors is saying that WriteMenuItems is not declared. It's a Javascript function I have in an included JS file. Not too sure why it works great in IE 6 but it sure doesn't in the older versions.


<?
if ( $_COOKIE['auth'] == "" && $use_cookies == TRUE ){
die ("You are not authorized to view this page. 404.");
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<meta name="robots" content="noindex,nofollow">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<title>Flyspeck - Edit</title>
<link href="includes/flyspeck_css.css" rel="stylesheet">
<script type="text/javascript" src="includes/flyspeck_js.js"></script>
<script type="text/javascript" language="Javascript1.2">
_editor_url = "htmlarea/"; // URL to htmlarea files
_editor_field = "";
var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5) {
document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
document.write(' language="Javascript1.2"></scr' + 'ipt>');
} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
var MyBgColor ='#FFFFFF';
var MyBgImg ='';

</script>
<script>
function updateAttributes(){
document.myform.bgcolor.value=MyBgColor;
document.myform.background.value=MyBgImg;
}
</script>
<STYLE TYPE="text/css">
.headtext { font-size:10pt;font-weight:bold; }
TD, DIV {font:9pt Verdana,Arial, Helvetica, sans-serif;}
</STYLE>
</head>

<body onload="goContext(); javascript:hide();">
<?php
require "includes/config.php";
include "includes/header.php";
GLOBAL $absPath, $id;
// Declare Variables for the entire page.

$id = $HTTP_GET_VARS["id"];
$absPath = $HTTP_GET_VARS["absPath"];
$relPath = $HTTP_GET_VARS["relPath"];


echo debugMe( "The ID is " . $id . "<br>\n");
echo debugMe( "The absPath is " . $absPath . "<br>\n");
echo debugMe( "The relPath is " . $relPath . "<br>\n");

$editContent = findContent ($absPath, $id);
?>

<textarea name="editorarea" cols="" rows="" style="width:97%; height:250;"><?=$editContent?></textarea>

<form action="saveme.php" name="contentHolder" method="post" <? if ($debug != TRUE) {echo "style=display:none";}?> >
<b>Debugging Information</b>&nbsp;<em>You must hit submit in debugging mode!</em><br>
<hr>
Editable ID: <input type="text" name="id" value=<?=$id?>><br>
Absolute Path (absPath):<input type="text" name="absPath" size="50" value="<?=$absPath?>"><br>
Relative Path (relPath) : <input type="text" name="relPath" size="50" value="<?=$relPath?>"><br>
NewContent Holder:<textarea name="newContent" rows="4" cols="40"></textarea><br>
<button type="submit">Submit</button>

</form>

<?=$footer;?>
</body>
<script language="JavaScript1.2">
var config = new Object(); // create new config object

config.width = "100%";
config.height = "75%";
config.bodyStyle = 'background-color: white; font-size: xsmall;';
config.debug = 0;

<? if ($csspath != "") { ?>
config.stylesheet = "<?=$csspath?>";
<?}?>

// Add additional editor config settings here...

var relPath = "<?=$relPath?>";

editor_generate('editorarea',config);
WriteMenuItems('editorarea');

</script>
</html>

jbot
03-14-2005, 05:41 PM
when posting code, post the rendered code, not the input. after all, what's the point in posting PHP when we can't access all the properties etc.

petey20
03-14-2005, 05:51 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<meta name="robots" content="noindex,nofollow">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<title>Flyspeck - Edit</title>
<link href="includes/flyspeck_css.css" rel="stylesheet">
<script type="text/javascript" src="includes/flyspeck_js.js"></script>
<script type="text/javascript" language="Javascript1.2">
_editor_url = "htmlarea/"; // URL to htmlarea files
_editor_field = "";
var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);
if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5) {
document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
document.write(' language="Javascript1.2"></scr' + 'ipt>');
} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }
var MyBgColor ='#FFFFFF';
var MyBgImg ='';

</script>

<script>
function updateAttributes(){
document.myform.bgcolor.value=MyBgColor;
document.myform.background.value=MyBgImg;
}
</script>
<STYLE TYPE="text/css">
.headtext { font-size:10pt;font-weight:bold; }
TD, DIV {font:9pt Verdana,Arial, Helvetica, sans-serif;}
</STYLE>
</head>

<body onload="goContext(); javascript:hide();">
<table width="100%" cellpadding="4" cellspacing="0" style="font-family: Verdana; border: 1px solid #000099">
<tr>
<td width="100" height="20" style="background-color: white"><img hspace="3" src="http://www.xxx.com/admin/includes/images/flyspeck_logo.jpg"></td>
<td style="background-color: gainsboro;padding-left: 20px; font-weight: bold; font-size: 10pt; color: #000099">
Edit -> Edit your text and click the disk icon to save.

</td>
</tr>
</table>

<br>

The ID is 0<br>
The absPath is /usr/local/www/vhosts/xxx.com/htdocs/index.html<br>
The relPath is /index.html<br>
The file is available and readable<br>
the file is open<br>here is the editable region: <br>

Welcome to WildWorks

<textarea name="editorarea" cols="" rows="" style="width:97%; height:250;">
Welcome to WildWorks

</textarea>

<form action="saveme.php" name="contentHolder" method="post" >
<b>Debugging Information</b>&nbsp;<em>You must hit submit in debugging mode!</em><br>
<hr>
Editable ID: <input type="text" name="id" value=0><br>
Absolute Path (absPath):<input type="text" name="absPath" size="50" value="/usr/local/www/vhosts/xxx.com/htdocs/index.html"><br>
Relative Path (relPath) : <input type="text" name="relPath" size="50" value="/index.html"><br>
NewContent Holder:<textarea name="newContent" rows="4" cols="40"></textarea><br>
<button type="submit">Submit</button>

</form>

<p style="font-size:8pt; text-align: right">&nbsp;Copyright &copy; 2004 xxx.com All rights reserved.<br></p></body>
<script language="JavaScript1.2">
var config = new Object(); // create new config object

config.width = "100%";
config.height = "75%";
config.bodyStyle = 'background-color: white; font-size: xsmall;';
config.debug = 0;

config.stylesheet = "http://www.xxx.com/admin/includes/flyspeck_css.css";

// Add additional editor config settings here...

var relPath = "/index.html";

editor_generate('editorarea',config);
WriteMenuItems('editorarea');

</script>
</html>

liorean
03-14-2005, 05:58 PM
I would guess the function you mention is located in the editor.js file, correct? You only include that file for ie5.5+w.

Oh, and totally unrelated:
That splitting your strings that you do - you can stop that. You're doing it wrong in any case. A script element may not contain the "</" character sequence, and you still have that in it. Not that the common browsers care; but that's the sequence that should, in a stricter parser, be treated as the end of the script element. The best solution to that is to use a simple JavaScript escape thus: "<\/" instead of making a lot of string concatenations.

petey20
03-14-2005, 06:13 PM
Talk about your brain farts! ha ha

Thanks.

Must be a reason I was doing that. Getting some errors now in my editor.js.

Unfortunately it's about 2500 lines of code and would be hard for me to post that.

jbot
03-14-2005, 06:57 PM
Getting some errors now in my editor.js. Unfortunately it's about 2500 lines of code and would be hard for me to post that.

split it into different files and see which throws the error(s) and where.

petey20
03-14-2005, 07:04 PM
My errors in editor.js

window.createPopup is not a function

var oPopup = window.createPopup();

Error: navigator.systemLanguage has no properties

this.systemLang= navigator.systemLanguage.split("-");


Error: oPopup has no properties


var oPopup = window.createPopup()
function goContext(){
var oPopupBody = oPopup.document.body;

jbot
03-14-2005, 07:16 PM
if the error is in FF, then it's down to window.createPopup() since that's an IE only method.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum