.php和.html文件和外部文件不起作用

时间:2012-06-15 12:18:29

标签: php javascript html

您好,我有以下代码

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

<head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8" />

        <link rel="stylesheet" href="lib/css/css6f31.css?page=login" type="text/css" />
        <script src="lib/js/jquery.js" type="text/javascript"></script>
        <script src="lib/js/js6f31.php" type="text/javascript"></script>

    </head>
    <body id="page-login">





        <div id="content">

<div id="forgot" class="form-wrap">
    <form id="form-forgot" action="#" method="post">
        <fieldset class="inputs glow-container">
             <label for="forgot-email">Email</label>
             <!--  value="Enter your email address" -->
            <input type="text" class="last text" id="forgot-email" tabindex="1" name="forgotEmail" />
        </fieldset>
        <fieldset class="buttons">
            <a href="#" id="forgot-cancel" class="button hoverfade">Cancel</a>
            <a href="#" id="forgot-send" class="button button-submit hoverfade">Send Password</a>
            <div class="spinny"></div>
        </fieldset>
    </form>
</div>

<div id="login" class="form-wrap">
    <form id="form-login" action="#" method="post">
        <fieldset class="inputs glow-container" style="height: 167px;">
            <label for="login-email">Email</label>
            <input type="text" class="text" id="login-email" tabindex="2" name="loginEmail" value="" />

            <label for="login-password">Κωδικός <a id="forgot-link" href="#">υπενθύμιση κωδικού!</a></label>
            <input class="last text" type="password" id="login-password" tabindex="3" name="loginPassword" />
            <label><a id="signup-link" href="#">δημιουργία λογαριασμού!</a></label>
        </fieldset>
        <fieldset class="buttons">
            <div class="spinny"></div>
            <a id="login-login" class="button button-submit hoverfade">Log in</a>
            <button type="submit" style="height: 0; width: 0; border: 0;"></button>
        </fieldset>
    </form>
</div>



        </div>
    </body>

</html>

当文件名为index.html时,当我将其重命名为index.php时,一切正常,它不会加载css文件或javascript文件。

2 个答案:

答案 0 :(得分:1)

检查此LOC -

<script src="lib/js/js6f31.php" type="text/javascript"></script>

修改

请确保您通过网络服务器运行此.php文件。

答案 1 :(得分:-1)

这条线错了。你不能在src中调用php文件。 src只能调用在客户端站点中执行的文件,如javascript文件,vbscript文件,....

<script src="lib/js/js6f31.php" type="text/javascript"></script>

请使用此代码:

<script type="text/javascript">
    <?php include 'lib/js/js6f31.php'; ?>
</script>