【发布时间】:2011-01-06 14:22:45
【问题描述】:
我遇到了一个烦人的问题,我已经问了一些问题,现在我终于找到了它,我想我已经接近解决方案了,当然在你的帮助下。
我有两个 JavaScript 文件,都使用 jQuery,但只有一个在运行。一个工作以“$(document).ready(function(){..”开头并且工作正常。另一个不工作以“function pageLoad(){..”开头。
我需要 pageLoad 事件的原因是因为它甚至在异步 postBacks 上也被触发,但它甚至没有在非异步 postbacks 上加载? ..
我猜代码中有一些问题导致它出错,但它在我的本地机器上工作得很好,但是一旦它通过 Internet 在我的网络主机服务器上运行,该 javascript 文件中的所有内容都是只是不工作。
代码:
function pageLoad(){
alert("this does not even show :(");
//var's to be set
var sendPM_pxToBottomWhenAutoScrolling = 140 //
$(".NewConversationTrigger").click(function() {
$("#pm_area_OpenSamtaleID").val(this.id);
$("#pm_area_TriggerOpenSamtale").click();
});
//Auto Scroll system for PM
if ($(".nyPM_SubmitButton").attr("disabled") == true) {
$(".scrollToBottom").attr({ scrollTop: $(".scrollToBottom").attr("scrollHeight") });
}else{
$(".scrollToBottom").animate({ scrollTop: ($(".scrollToBottom").attr("scrollHeight") - $(".scrollToBottom").height() - sendPM_pxToBottomWhenAutoScrolling) }, 1000);
}//Auto Scroll system for PM
//Reciver PM's
$(".SentPM:not(:last-child)").hover(function() {
$(this).children(".PM_Options").show();
}, function () {
$(this).children(".PM_Options").hide();
});//Reciver PM's
$(".RecivedPM").hover(function() {
$(this).children(".PM_Options").show();
}, function () {
$(this).children(".PM_Options").hide();
});//Reciver PM's
//TypeWatch
$("#userlist_area_filterText").typeWatch({ highlight:true, callback:finished } );
function finished(txt) { $("#userlist_area_filterSubmit").click() };
$(".updateSamtaleVindue").click(function(){
$("#pm_area_OpenSamtaleID").val(this.id);
$("#pm_area_TriggerOpenSamtale").click();
});
$(".nyPM_SubmitButton").click(function(){
$("#pm_area_SendMessageText").val($(".nyPM_TextArea").val());
$("#pm_area_TriggerSendMessage").click();
$(".nyPM_SubmitButton").attr("disabled","disabled"); $(".nyPM_SubmitButton").val("Din Besked er Sendt");
$(".nyPM_TextArea").attr("readonly", true); $(".nyPM_TextArea").addClass("SentPM_FakeBox")
});
}
【问题讨论】:
标签: asp.net javascript jquery asp.net-ajax