私の機能は、ie8以降を除くすべてのブラウザで機能します。誰が問題が何であるか、おそらくそれを修正する方法を教えてもらえますか?ありがとう!機能は= <ie8以外のすべてのブラウザで機能します
var match;
var chords =
['C','C#','D','D#','E','F','F#','G','G#','A','A#','B','C','Db','D','Eb','E','F','Gb','G','Ab','A','Bb','B','C'];
var chords2 =
['C','Db','D','Eb','E','F','Gb','G','Ab','A','Bb','B','C','C#','D','D#','E','F','F#','G','G#','A','A#','C'];
var chordRegex = /C#|D#|F#|G#|A#|Db|Eb|Gb|Ab|Bb|C|D|E|F|G|A|B/g;
function transposeUp(x) {
$('.chord'+x).each(function(){
///// initializes variables /////
var currentChord = $(this).text(); // gatheres each object
var output = "";
var parts = currentChord.split(chordRegex);
var index = 0;
/////////////////////////////////
while (match = chordRegex.exec(currentChord)){
var chordIndex = chords.indexOf(match[0]);
output += parts[index++] + chords[chordIndex+1];
}
output += parts[index];
$(this).text(output);
});
}
function transposeDown(x){
$('.chord'+x).each(function(){
var currentChord = $(this).text(); // gatheres each object
var output = "";
var parts = currentChord.split(chordRegex);
var index = 0;
while (match = chordRegex.exec(currentChord)){
var chordIndex = chords2.indexOf(match[0],1);
output += parts[index++] + chords2[chordIndex-1];
}
output += parts[index];
$(this).text(output);
});
}
EDIT
私はちょうどそれは同様の分割方法に関係していることが分かりました。私はそれを修正することはできません。 indexOfプロトタイプは現在動作していますが、関数はまだ動作していませんが、chordRegexはオブジェクトではないというエラーが表示されます。何らかの理由でそれが機能していません。
の$.inArray機能を使用する必要があります。 :) –
LOL、thats funny。ありがとう! –