开发者

JEasyUI makes the page to run twice

Here is my code. When I execute this, alert runs twice. Any help on this.

Is there any problem with my code or jeasyui framework had a problem?

    <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Border Layout - jQuery EasyUI Demo</title>
    <link rel="stylesheet" type="text/css" href="jui/themes/default/easyui.css">
 开发者_运维问答   <script type="text/javascript" src="jui/jquery-1.6.min.js"></script>
    <script type="text/javascript" src="jui/jquery.easyui.min.js"></script>
</head>
<body class="easyui-layout">
    <div region="north" border="false" style="height:60px;background:#B3DFDA;">north region</div>
    <div region="west" split="true" title="West" style="width:150px;padding:10px;">west content</div>
    <div region="east" split="true" title="East" style="width:100px;padding:10px;">east region</div>
    <div region="south" border="false" style="height:50px;background:#A9FACD;padding:10px;">south region</div>
    <div region="center" title="Main Title">

        <script type="text/javascript" >
            $().ready(function(){
                alert("hi4a11. I am running twice");
            });
        </script>
        testing
    </div>
</body>
</html>


I wonder, why do you put the ready function inside div region="center"? That's where the problem is coming from. The code runs twice, because it has been loaded when DOM ready and when layout ready.

Just move your ready script function to head section and your problem should be solved.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜