簡體   English   中英

Microsoft JScript運行時錯誤:無法獲取屬性“ radalert”的值:對象為null或未定義IE8

[英]Microsoft JScript runtime error: Unable to get value of the property 'radalert': object is null or undefined IE8

我正在通過服務器端Java腳本在ASP.NET應用程序文件后面的代碼中調用RadAlert。 此RadAlert在IE7,IE9,Chrome和Firefox上正常工作,但IE8拋出“ Microsoft JScript運行時錯誤:無法獲取屬性” radalert”的值的異常:對象為null或未定義”。 請任何人告訴我如何解決此問題。 以下是代碼

string dialogMessage = "Record " + Session["SavedRecordID"].ToString() + " Saved Successfully";
string radalertscript = "<script language='javascript'> window.onload = function() {var oWnd = radalert('" + dialogMessage + "', 400, 140, 'Saved'); window.setTimeout(function () { oWnd.Close(); }, 3000);} </script>";
Page.ClientScript.RegisterStartupScript(this.GetType(), "radalert", radalertscript);

謝謝。

radalert對象的構建可能在IE 8中為時已晚。由於ASP.NET AJAX組件使用的生命周期可能不同,因此您也可以嘗試(至少要消除我在說的是否是實際問題) :

Sys.Application.add_load(function(sender, e) {
  var oWnd = radalert('" + dialogMessage + "', 400, 140, 'Saved');
  window.setTimeout(function () { oWnd.Close(); }, 3000);}
});

您應該能夠從服務器渲染它,並且它的功能相同。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM