aspサーバーボタンをクリックすると、ボタンが次のように表示されるときにJavaScriptメソッドが実行されるサーバーサイドコードがプレビューされます。同時にonClientClickを使用しているときにaspサーバーボタンのonClickイベントが発生しない
<asp:Button ID="Button3" runat="server" onclick="Button3_Click" OnClientClick="timing()" Text="Check Spam" />
両方の方法を実行しますが、ボタンをもう一度クリックするとJavaScriptのみの方法は、私が検索し、いくつかの解決策を見つけたが、それらのどれも私のために働いていない、任意の助けを を実行し、すべてが正常に動作します初めてアプリケーションをクリックしたときお寄せいただきありがとうございます ありがとうございました
使用されるJavaScriptの方法
var popupStatus = 0;
function loadPopup() {
//loads popup only if it is disabled
if (popupStatus == 0) {
var test = document.getElementById('ctl00_ctl00_ContentPlaceHolder1_ContentPlaceHolder2_hidden1').value + "<div>success <input id=\"Button1\" type=\"button\" value=\"button\" onclick=\"disablePopup()\" /> </div>";
$("#popupContact").html(test);
$("#backgroundPopup").css({
"opacity": "0.7"
});
$("#backgroundPopup").fadeIn("slow");
$("#popupContact").fadeIn("slow");
popupStatus = 1;
}
}
function disablePopup() {
//disables popup only if it is enabled
if (popupStatus == 1) {
$("#backgroundPopup").fadeOut("slow");
$("#popupContact").fadeOut("slow");
popupStatus = 0;
}
}
function centerPopup() {
//request data for centering
// var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var windowWidth = document.documentElement.clientWidth;
var popupHeight = $("#popupContact").height();
var popupWidth = $("#popupContact").width();
//centering
$("#popupContact").css({
"position": "absolute",
"top": windowHeight.top - popupHeight/2,
"left": windowWidth/2 - popupWidth/2
});
//only need force for IE6
$("#backgroundPopup").css({
"height": windowHeight
});
}
function check() {
centerPopup();
loadPopup();
}
function timing() {
setTimeout('check()', 10000);
}
機能タイミングは10秒待ち、次いでチェックWICHをロードするために2つのメソッドを呼び出し、センターポップアップ
私はtiming()関数でコードを投稿するべきだと思います。 – chandmk
私は質問を編集し、使用されたすべてのjavascript関数を追加しました。 –