イベントのバブリングの発生を停止する方法に関するコードをどこでも探しましたが、QuirksmodeのWebサイトから次のコードを見つけました。
function doSomething(e){
if(!e) var e = window.event;
e.cancelBubble = true;
if(e.stopPropagation) e.stopPropagation();
}
でも、どこでどのように使うのかわかりません。'e'パラメータは何として使用されますか(または'e'として渡される必要があります)?この関数はイベントハンドラーコードで呼び出されますか?...等?
助けが必要です。誰かが私にヒントを教えてもらえますか?
基本的に、次のように、「updateAvailableAttributes()」と呼ばれる「onchange」ハンドラーを持つ4つの要素があります。
<select id="deliveryMethod" name="deliveryMethod" onchange="updateAvailableAttributes();"></select>
<select id="formatMethod" name="formatMethod" onchange="updateAvailableAttributes();"></select>
<select id="yearsMethod" name="yearsMethod" onchange="updateAvailableAttributes();"></select>
<select id="updateMethod" name="updateMethod" onchange="updateAvailableAttributes();"></select>
updateAvailableAttributes()スクリプトは次のとおりです。
function updateAvailableAttributes() {
var form = document.forms["orderDefinition"];
form.elements["formChangeRequest"].value = "true";
$.ajax({
type: "POST",
url: "ajax/possibleValues.html",
data: $("form#orderDefinition").serialize(),
success: function(response){
$('#usercontent .sleeve .toprow').html(response);
applyValidation();
radioButtonHighlightSelection();
},
error: function(response, ioArgs) {
if (response.status == 601) {
sessionTimedOut();
}
}
});
// Display a "please wait" message
$("#waitingMsgOverlay, #waitingMsgBox, #waitingMsg, #waitingMsgParag").ajaxStart(function(){
var map = document.getElementById("OrderMap");
map.disableApplication();
$(this).show();
radioButtonHighlightSelection();
}).ajaxStop(function(){
var map = document.getElementById("OrderMap");
map.enableApplication();
$(this).hide();
$("#toolpanel").height($("#orderMap").height());
radioButtonHighlightSelection();
});}
私の質問は、「doSomething(e)」を「updateAvailableAttributes()」に組み込むにはどうすればよいですか?すでに「onchange」イベントハンドラーにありますか?
前もって感謝します。