-2
<!DOCTYPE html>
<html>
<head>
 <div id="header">
     <center><button type="button" onclick="JavaScript:prompt('so far sogood')">
  click</button></center>
  </div>

 <style type="text/css">                                 
#one{width:100%; height:100px;background-color:red;}
#two{width:100%; height:100px;background-color:green;}
#header{width:100%; height:100px;background-color:yellow;}
</style>
<script type="text/javascript">

$(document).ready(function(
{
$('.one').mouseenter(function()
{
$(this).fadeOut('slow'); 
});

$('.one').mouseleave(function()
    {
 $(this).fadeIn('fast');

}); 

});
</script>


 </head>
<body bgcolor="black">





<div id="one"><center>HELLO</center></div>
 <div id ="two">hello</div>
 </body>

私の問題は、私のjquery行が発生した直後に始まる$(document)場所のようです。どうやらこれが起こる前に何かを置いていないようです。私はjqueryが初めてで、通常は外部CSSページを使用するため、異なる形式が発生します

4

1 に答える 1

2

構文エラーがあります: 準備完了関数宣言の後に最後の括弧がありません

$(document).ready(function( {

試す

    <script type="text/javascript">
        $(document).ready(function() {
            $('.one').mouseenter(function() {
                $(this).fadeOut('slow');
            });

            $('.one').mouseleave(function() {
                $(this).fadeIn('fast');

            });

        });
    </script>

DEMO

于 2013-02-21T17:30:45.740 に答える