JavaScriptで基本的な機能を持っています。プリセットされた値をプリセットされた関数を使ってスクリーンに表示するだけです。私がやっていることの最初の行をブレークポイントすると、ページは正常にロードされますが、ブレークポイントを削除するとすぐに情報は設定されません。ページは空白です。その内部JavaScriptはブラウザデバッガで設定されたブレークポイントでのみ動作します
this.QuizSelection = function() {
// Fill the ID's with the right info
app.SetBackground('head', this.HeroImage);
console.log('1 ' + this.HeroImage);
app.LoadInnerHTML('breadcrumbs', 'Home/' + this.Title);
app.LoadInnerHTML('quizSelectionTitle',this.Title);
console.log('2 ' + this.Title);
app.LoadInnerHTML('quizSelectionIntro',this.Introduction);
console.log('3 ' + this.Introduction);
// Show the Quiz Selection and Heading
app.ShowSection('head');
app.ShowSection('quizSelection');
console.log('Quiz Selection');
}.bind(this);
機能(SetBackgroundとLoadInnerHTML)は、内側HTMLおよびセット背景画像を変更するだけ小さな一行関数です。
// Change Inner HTML
this.LoadInnerHTML = function (id, html) {
var d = document.getElementById(id);
d.innerHTML = html;
}
// Set Background Image
this.SetBackground = function (id, image) {
document.getElementById(id).style.backgroundImage = 'url(image)';
}
ブレークポイントがオンになっていないと、なぜ動作しないのか理解できません。明らかに、すべてが上のブレークポイントと罰金ですが、それは結果オフだときに、私は、コンソールに出力を得るために、仕事をしている:
1
2
3 undefined
Quiz Selection
データを表示する方法ではなく、最初にデータを取得する方法です。 'this.Title'、' this.Introduction'などはどこから来ましたか? – JJJ
JSONファイルから来ています - デバッガの変数を見るとうまくロードされます –
Ajaxコール?ベスト推測:[非同期呼び出しから応答を返すにはどうすればよいですか?](http://stackoverflow.com/questions/14220321/how-do-i-return-the-response-from-an-asynchronous-call) – JJJ