包含jQuery时的空白页面

时间:2012-02-08 15:49:15

标签: php jquery

我正在尝试在PHP脚本中添加jQuery。除了添加jQuery脚本外,一切顺利。然后页面变成空白。

这是我的代码:

function site_header() {
    echo "<html dir=\"rtl\"> 
    <!DOCTYPE HTML>
    <html>
    <head>
    <meta name=\"viewport\" content=\"width=device-width; initial-
        scale=1.0; maximum-scale=1.0;\">
    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
    <title>Arabsfun :: تسالي العرب</title>
    <link href=\"css/style.css\" type=\"text/css\" rel=\"stylesheet\">";

    echo Pulse::css(); 
    echo Pulse::javascript(); 
    echo "</head>
<body>
    <div id=\"wrap\">     
        <div class=\"header\">
            <div class=\"logo\">
                <a href=\"index.php\"><img src=\"images/logo.png\" alt=\"Arabsfun\" /></a>
            </div>
            <div class=\"clear-float\">
            </div><br>
        </div> 
    <div class=\"content\">" . navbar() ." </div>
        </center>" ;
}

然后我使用函数site_header()启动页面上的标题。

关于如何解决这个问题的任何想法?

4 个答案:

答案 0 :(得分:4)

我根本没有在该代码中看到任何对jQuery的引用。我打算假设你输入的内容如下:

<link href=\"css/style.css\" type=\"text/css\" rel=\"stylesheet\">
<script type=\"text/javascript\" src=\"jquery.js\">

您需要关闭</script>,否则整个页面将被视为脚本,不会发出任何内容。

答案 1 :(得分:3)

我也遇到过这个。我的答案是使用脚本结束标记,而不是用单个标记中的斜杠结束它。 IE不会接受它。

这就是我没有用的东西......

<script type="text/javascript" src="#variables.jQueryURL#" />

这就是我改变它的原因......

<script type="text/javascript" src="#variables.jQueryURL#"></script>

(那里有一个ColdFusion变量,但这个问题无关紧要。)

答案 2 :(得分:0)

把它简单化为html并包含它。您没有为需要哪个服务器端脚本(对于标头)做任何事情。

答案 3 :(得分:0)

在编辑代码时,我注意到了不相等的标签。您的<body>代码未关闭,可能还有其他代码。