Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Works in IE 6 but not 5.2 or Firefox

    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.

    PHP Code:
    <?
    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>

  • #2
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    *keep it simple (TM)

  • #3
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    PHP Code:
    <!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> 

  • #4
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    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.
    Last edited by liorean; 03-14-2005 at 06:04 PM.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #5
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Last edited by petey20; 03-14-2005 at 06:16 PM.

  • #6
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by petey20
    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.
    *keep it simple (TM)

  • #7
    New to the CF scene
    Join Date
    Jun 2004
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My errors in editor.js

    window.createPopup is not a function
    Code:
    var oPopup = window.createPopup();
    Error: navigator.systemLanguage has no properties
    Code:
    this.systemLang= navigator.systemLanguage.split("-");

    Error: oPopup has no properties
    Code:
    var oPopup = window.createPopup()
    function goContext(){
    var oPopupBody = oPopup.document.body;

  • #8
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    if the error is in FF, then it's down to window.createPopup() since that's an IE only method.
    *keep it simple (TM)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •