0

現在の値で更新することに集中できません。このコードにバグがありますか、それとも私が見逃しているよりクリーンなアプローチがありますか? 「これ」または「イベント」を渡すことはできますか?

このエラーが発生しています:

'focused is not defined'

私はこのコードブロックを持っています:

$("input, select, textarea, button, .link, div, .button").live({
  click:clearDefault,
  focusin:function() {focused = ($(this).attr('title'))},
  focusout:function() {focused = false},
  mouseover:onHelp,
  mouseout:helpFallback
});

これらの機能に対応するもの:

function onHelp() {
if (!helpDiv) {
    helpDiv = $('#helpText');
}
var $this = $(this);
var text = $this.attr('title');
if ($this.attr('titlehtml')) {
    var text = $this.attr('titlehtml');
}
if ($this.hasClass('screenshot')) {
    text += "<img src='images/icon_table_" + $this.attr('id') + ".png' >";
}
if ($this.attr('errorhtml')) {
    text += "<div id='userError'>"+$this.attr('errorhtml')+"</div>";
}
helpDiv.show().html(text);
}

function helpFallback() {
    if (focused) {
        helpDiv.show().html(focused);
    } else {
        helpDiv.hide();
    }
}
4

1 に答える 1

0

以下のように focused を定義し、いくつかのデフォルト値を設定します

var focused = false;
于 2011-06-29T18:18:08.573 に答える