0

これは質問のための大量のコードですが、基本的にこれは機能していました、それから私はそれを微調整しようとしました、そしてそれを壊すことができました。誰かが問題を見つけることができますか?実際にはカップルがいるかもしれません。

基本的に、jqueryを学習しているのは私だけで、入力から値を取得したいのですが、ユーザーが[比較]をクリックすると、回答のグラフがゆっくりと作成され、事前設定された「平均的な」回答に対して同じことが行われ、最終的には彼らの答えと平均の違いを彼らに伝えてください。

<h2 id="compare">Compare your score with the average</h2>

<p><a href="#compare" class="run">Compare</a></p>
<div style="height:400px;position:relative;">
<div id="score" style="position:absolute;left:0px;bottom:0px;width:200px;height:2px;background-color:#01DFD7;float:left;"></div>
<div id="score2" style="position:absolute;left:220px;bottom:0px;width:200px;height:2px;background-color:#FFD;float:left;"></div>
</div>

<input id="yourValue" type="text" />

<p id="answer"></p>

<script type="text/javascript">  
$('.run').click(function(){  
var theValue = $("#yourValue").val();
$('#score').animate({height:'theValue'}, 5000, function(){
  $('#score2').animate({height:'200px'}, 5000, function(){
      $('#answer#).html("<p>Your Answer: </p>" +  theValue);
  });
});
});
</script>  
4

1 に答える 1

4

{height:'theValue'}-引用符で囲むべきではありません。引用符は、実際にtheValueの値が必要な文字列であることを意味します。

$('#answer#)-構文的には正しくありません。$('#answer')が必要だと思います

于 2012-05-11T21:46:32.413 に答える