jeasy-ui两次运行div

时间:2011-09-29 11:08:07

标签: php javascript html jquery-easyui

在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有一些bug。帮帮我解决这个问题。

2 个答案:

答案 0 :(得分:1)

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

时才有可能

答案 1 :(得分:0)

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

    

</div>

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

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