2011-01-07 6 views
0

私は以下のコードを持っています。私の人生のために、なぜ動作しないのか理解できません。どんな助けでも大歓迎です。おかげテーブル内でスライドのトグルが機能しない

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<title>Simple Tabs with CSS &amp; jQuery</title> 
<style type="text/css"> 
body { 
margin:1em; 
padding:0; 
height:100%; 
background-color:#cbcbcb; 
color:#000000; 
text-align:center; 
font-family:Arial, Helvetica, sans-serif; 
border-style: thin; 
} 

h1 {font-size: 3em; margin: 20px 0;} 
.hidden{ 
background-color:gray; 
width:120px; 
text-decoration:none; 
font-size:x-large; 
color:black; 
display:none; 
border:thin; 
border-bottom-color:gray; 
} 

<script type="text/javascript"> 

$(document).ready(function() { 
$("#button").click(function() { 
$(".hidden").slideToggle(200); 
}); 
<body> 
<div class="hidden">woot</div> 
<table style="width: 100%" cellspacing="1" class="style1"> 
<tr> 
    <td class="style1">Username</td> 
    <td class="style1">Last Name</td> 
    <td class="style1">First Name</td> 
    <td class="style1">MI</td> 
    <td class="style1">Address</td> 
    <td class="style1">Email</td> 
    <td class="style1">Age</td> 
    <td class="style2"><p id="button"><a href="#">Toggle</a></p>&nbsp;</td> 
</tr> 
</table> 
</body> 
+0

含めていません

  • ...、interwebsを経由してあなたの心を読むことができない人の使用のそれらを啓発してください? – Bojangles

  • 答えて

    1

    あなたが決算});とクローズ</script></style>タグを逃しています。

    $(document).ready(function() { 
        $("#button").click(function() { 
         $(".hidden").slideToggle(200); 
        }); 
    }); 
    

    適切なインデントが明らかになる。 :あなたが働いていない、正確に何を意味するのフィドルhttp://jsfiddle.net/rKYSB/

    +0

    +1ちょうど私にそれを打つ - それだけでなく、 'head'、' style'と 'script'タグは閉じられていません。 –

    +0

    @ジョナサン:うん、あまりにもそれらに気づいた。 :o) – user113716

    +0

    ああ!不思議ではない。ありがとう! :) – corybranan

    0

    、それを更新しますか?これはあなたのページの完全なコードですか?

    その場合:

    スクリプトタグが閉じていない
    • あなたの頭のタグが閉じていない
    • あなたが閉鎖を}欠けています)。あなたはそれについては動作しませんどのようなjQueryのスクリプト
    2

    作業

    $(document).ready(function() { 
        $("#button").click(function() { 
         $(".hidden").slideToggle(200); 
        }); 
    }); 
    

    :あなたがクローズ}); JavaScriptを逃しているO)

    +0

    +1 jQueryが参照されていないという事実を完全に逃した –

    +0

    +1私はそれも逃しましたが、 'jQueryUI'はここでは必要ありません。 – user113716

    +1

    ああ、習慣の力。私は更新します – Paul

    関連する問題