1

在 master.php

<?php
//echo "session check: ".$_SESSION['session_array'];
//exit;
session_start();  // Session Starts

if( !isset($_SESSION['session_array']) )
{
    header("Location: index.php");
    exit;
}

include("conn.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LMS</title>
    <link rel="stylesheet" type="text/css" href="jui/themes/gray/easyui.css">
    <link rel="stylesheet" type="text/css" href="jui/general.css">
    <link rel="stylesheet" type="text/css" href="jui/themes/icon.css">
    <script type="text/javascript" src="jui/jquery-1.6.min.js"></script>
    <script type="text/javascript" src="jui/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="js/jquery.validate.js"></script>
    <script type="text/javascript" src="js/date.js"></script>

    <script type="text/javascript" src="js/core.js"></script>




</head>
<body class="easyui-layout">
    <div region="north" class="north_master" border="false" split="false" >
      <div style="float:left;">
        <img src="images/usr_logo.jpg" alt="Lead Management System" width="168" height="66" title="Lead Management System" >
      </div>
      <div style="float:right;">
        <br/><br/>

        <a id="logout" name="logout" href="logout.php?logout=1" class="easyui-linkbutton" iconCls="icon-cancel" onClick="javascript: return confirm('Are you sure you want to log out?');">Logout</a>
      </div>
    </div>

    <div region="south" class="south" border="false">
        <?php include('footer.php'); ?>
    </div>

    <div region="center" class="center" style="background-image:url(img/product-display.jpg);background-repeat:no-repeat;background-attachment:fixed;background-position:right bottom;  ">
        <?php

                        include('dashboard.php');

              ?>
    </div>

</body>
</html>

在dashboard.php

<script language="javascript">
jQuery(document).ready(function($){
alert("check");
});
</script>
<div class="content">
    <h1>Slot Dashboard</h1>

    <div>
    <a href="master.php?page=5" class="easyui-linkbutton">Add Slot</a>
    </div>    

    <table border='1' bordercolor='#B4B4B4'  cellpadding='1' cellspacing='0'  width='80%' align="center">
    <tr align="left">
    <th>Week</th>
    <th>Dates</th>
    <th>Status</th>
    <th>Date</th>
    <th>Action</th>
    </tr>

    <tr>
    <td>1</td>
    <td>09/04/2011 - 09/10/2011</td>
    <td>Revised</td>
    <td>09/04/2011</td>
    <td><a href="#">View</a></td>
    </tr>

    <tr>
    <td>2</td>
    <td>09/11/2011 - 09/17/2011</td>
    <td>Revised</td>
    <td>09/11/2011</td>
    <td><a href="#">View</a></td>
    </tr>

    <tr>
    <td>3</td>
    <td>09/18/2011 - 09/24/2011</td>
    <td>Not Submitted</td>
    <td>09/18/2011</td>
    <td><a href="#">View</a></td>
    </tr>

    </table>

</div>

问题:当 master.php 运行“ check”两次警报时。我需要知道为什么“ check”会发出两次警报。如何解决这个问题

<div region=center>

div 中的脚本运行两次。jeasy-ui 有一些错误。帮我解决这个问题。

4

2 回答 2

1

技术上包含的页面警报不应触发两次。只有在 php.ini 中添加 sample.php 文件时才有可能auto_append_file

于 2011-09-29T11:22:44.407 回答
0

我在easyui每个版本都发现了同样的问题,当脚本包含在面板/布局中时,脚本将运行两次,我认为的原因是:页面在浏览器中加载,浏览器运行页面脚本一次,当dom是加载后,dom中节点的easyui渲染样式,节点中的脚本会被easyui第二次调用。这个问题不仅在布局中,而且在面板中,甚至可能是从面板继承的每一件事。这个问题可能在easyui的root render方法中,所以没有src我找不到解决方法。现在我必须将easyui更改为另一个ui框架。例如对于这个问题,警报在浏览器中被调用两次:

</div>

<div region="south" class="south" border="false">
</div>

<div region="center" class="center" >
      <script>
        alert("here");
      </script>
</div>

于 2011-10-14T03:44:49.497 回答