0

PHP でサイトを作成しており、コンテンツ タグを交換するインデックス ページを作成しました。ボタンの中に default.php を含めると、スタイルが設定されません。

Jquery UI はサイト内の他の場所では正常に機能しますが、ボタンとアイコンは機能しません。

ページを切り替えるインデックスコードはこちら

<?php
    include_once 'config.php';
    session_start();
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" >

    <title><?php echo $siteName; ?></title>
    <link href="css/themes/<?php echo $theme; ?>" rel="stylesheet" type="text/css"/>
    <link href="<?php echo $jqCSS;?>" rel="stylesheet" type="text/css"/>
    <script src="<?php echo $jsCommon;?>"></script> 
    <script src="<?php echo $jqJS;?>"></script>
    <script src="<?php echo $jqJSUI;?>"></script>


</head>

<body>

<div class="header">
    <?php include 'menu.php';?>
</div>  
<div class="content" id="main_content"><br/><br/>
    <?php 
        $page = $_SESSION['currentpage'];
        echo $page;
        switch ($page)
        {
            case 'messaging':
                include 'controls/shared/messaging/messaging.php';
                break;
            default:
                include 'pages/default.php';
                break;
        }       
    ?>
</div>

<div class="footer">
</div>
<div id="myLogin" title="Login"></div>
<div id="myForgotPass" title="Forgot Password"></div>
<div id="myReg" title="Register"></div>

チェック後に読み込まれる Default.php は次のとおりです。

<?php 
 session_start();
$_SESSION['currentpage'] = 'default';

?>
<br/><br/>
<h1>Default</h1>

<button id="button">Test Button</button>

これがボタンであると判断するために使用しているJavaScriptは次のとおりです。

$('#button').button();

firebug のコードを見ると、コンテンツ クラスの下にあることがわかります。コンテンツ クラスを使用してボタンのスタイルを設定できますが、jquery ui のテーマを使用したいと考えています。

ありがとう。

4

1 に答える 1

0

私はそれを考え出した。

最大の問題は、jquery が呼び出される前に自分の custom.js ファイルが呼び出されていたため、ボタンを作成しようとしたときに jquery が読み込まれなかったことです。

それをしたら、 $('button').button(); を使用しました。そして正常に動作するようになりました。

于 2013-02-12T14:45:20.707 に答える