浏览代码

Fix javascript error

pdontthink 22 年之前
父节点
当前提交
1bb593e100
共有 1 个文件被更改,包括 8 次插入3 次删除
  1. 8 3
      include/options/display.php

+ 8 - 3
include/options/display.php

@@ -19,7 +19,8 @@ define('SMOPT_GRP_MESSAGE', 2);
 /* Define the optpage load function for the display options page. */
 function load_optpage_data_display() {
     global $theme, $language, $languages, $js_autodetect_results,
-    $compose_new_win, $default_use_mdn, $squirrelmail_language, $allow_thread_sort;
+    $compose_new_win, $default_use_mdn, $squirrelmail_language, $allow_thread_sort,
+    $optmode;
 
     /* Build a simple array into which we will build options. */
     $optgrps = array();
@@ -99,8 +100,12 @@ function load_optpage_data_display() {
                            SMPREF_JS_OFF        => _("Never"))
     );
 
-    $onLoadScript = "document.forms[0].new_js_autodetect_results.value = '" . SMPREF_JS_ON . "'";
-    $js_autodetect_results = SMPREF_JS_OFF;
+
+    if ($optmode != 'submit')
+       $onLoadScript = 'document.forms[0].new_js_autodetect_results.value = \'' . SMPREF_JS_ON . '\'';
+    else
+       $onLoadScript = '';
+
     $optvals[SMOPT_GRP_GENERAL][] = array(
         'name'    => 'js_autodetect_results',
         'caption' => '',