【发布时间】:2011-06-03 07:26:35
【问题描述】:
我注意到我的 jquery 代码不再工作,因为我开始做一些 php 包含。
显然,我希望从 index.php 主页的 js 文件中导入我的代码。但是,我的 html 代码将由 php 包含生成(我不知道这是否有问题)。
无论如何,这是我的php页面(index.php)的结构:
[...]
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="js/comments.js"></script>
</head>
<body>
<?php
// HEADER -----------------------------------------------
include("front/index/header.php");
// ------------------------------------------------------
?>
<div class="containerMiddleFullSize">
<div class="containerMiddle">
<?php
// BODY -------------------------------------------------
if ($_GET['page'] == "home")
{
include("front/index/home.php");
}
[...]
这是我的 jquery 代码(js/cmets.js):
$(function()
{
$(".content").Watermark("Écrire un commentaire...");
$(".content").focus(function()
{
$(this).height("50px"); //animate({"height": "50px",}, "fast" );
$(this).next(".button_block").slideDown("fast");
return false;
});
$(".cancel").click(function()
$(this).parent(".button_block").slideUp("fast").prev(".content").height("18px");
return false;
//}
});
});
欢迎任何帮助;)
干杯,
哥蒂。
【问题讨论】:
-
你的
front/index/header.php中有什么
标签: php jquery file include external