1

イベントのターゲット アクションを正しく設定するにはどうすればよいでしょうか。JavaScriptのイベントハンドラー関数内で、私は持っています

    alert(e.target.getAttribute('action')); // Outputs correctly
    alert(newAction); // Outputs newAction correctly
    e.target.setAttribute('action',newAction); // Seems to be the problem
    alert(e.target.action); // INCORRECT: Has some url prefixed to newAction

新しいアクション アラートには url+newAction が表示されますが、必要なのは newAction だけです。これについての助けをいただければ幸いです。ありがとう。

4

1 に答える 1

1

試すalert(e.target.getAttribute('action'))

于 2012-05-11T01:25:50.983 に答える