有效性和fancybox不会出现

时间:2017-06-13 06:52:12

标签: javascript php jquery html css

我刚刚开始学习编程。现在我正在研究我学习jquery的小项目。但我发现这些有些困难。有效插件和花哨的盒子根本不会出现。这是我的代码:

Fancybox:

<script type="text/javascript" src="../plugin/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<link rel="stylesheet" type="text/css" href="../plugin/fancybox/jquery.fancybox-1.3.4.css" />
<script type="text/javascript">
$(document).ready(function() {
    $(".fancybox").fancybox();
});
</script>
<?php
if(!defined("INDEX")) die("---");
?>
<h2>Galeri Foto</h2>
<div class="galeri">
    <table cellpadding="5">
        <tr>
            <?php
            $no=1;
            $artikel = mysqli_query($koneksi, "select * from `Tabel Galeri` order by id_galeri desc limit 12");
            while($data=mysqli_fetch_array($artikel)){
            ?>
            <td align="center">
                <a class="fancybox" href="../gambar/galeri/<?=$data['gambar'];?>" title="<?=$data['judul'];?>">
                <img src="../gambar/galeri/<?=$data['gambar'];?>" width="150" height="100">
                <br><?=$data['judul'];?>
                </a>    
            </td>
            <?php
                if($no%4 == 0) echo"</tr><tr>";
                $no++;
            }
            ?>
        </tr>
    </table>
</div>

有效期

<script src="../plugin/validity/build/jquery.validity.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="../plugin/validity/build/jquery.validity.css" >
<script type="text/javascript">
$(document).ready(function() {
    $("#formkontak").validate(function(){
        $("#nama").require('Nama tidak boleh kosong!');
        $("#email").require('Email tidak boleh kosong!').match('email', 'Email tidak valid!');
        $("#pesan").require('Pesan tidak boleh kosong!');       
    });
});
</script>
<?php
if(!defined("INDEX")) die("---");
?>
<h2>Kontak</h2>
<form method="post" action="?tampil=kontak_proses" id="formkontak">
    <table>
        <tr>
            <td>Nama</td>
            <td><input type="text" name="nama" id="nama"></td>
        </tr>
        <tr>
            <td>Email</td>
            <td><input type="text" id="email" name="email"></td>
        </tr>
        <tr>
            <td valign="top">Pesan</td>
            <td><textarea name="pesan" id="pesan" cols="50" rows="10"></textarea></td>
        </tr>
        <tr>
            <td></td>
            <td><input type="submit" value="Kirim Pesan"></td>
        </tr>
    </table>
</form>

索引文件:

<?php
session_start();
include("../lib/koneksi.php");
define("INDEX", true);
?>
<html>
    <head>
        <title> Halaman Pengunjung </title>
        <link rel="stylesheet" href="../css/style.css">
            <script type="text/javascript" src="../js/jquery-3.2.1.min.js"></script>
            <script type="text/javascript">
            $(document).ready(function() {
            });
            </script>
    </head>
    <body>
        <div id="container">
            <div id="header"></div>
            <div id="menu">
                <?php include("menu.php");?>
            </div>
            <div id="content">
                <div id="kiri">
                    <?php include("konten.php");?>
                </div>
                <div id="kanan">
                    <?php include("sidebar.php");?>
                </div>
            </div>
            <div id="footer">
                <p>Copyright &copy; HASBY FAHRUDIN</p>
            </div>
        </div>
    </body>
</html>

我尝试逐个跟踪我的代码(基于我读过的书)并在stackoverflow中寻找解决方案,但我无法使其工作。很抱歉提出一个基本问题,我希望有人可以帮助我。干杯!

0 个答案:

没有答案