我嘗試構建一個公告彈出功能。目前,我有一個回叫函數來檢查是否有人修改announcement.html。JQuery UI對話框不會彈出
所以這裏是代碼
<div id="popupDialog" class="cs_AnnoucementPop">
<?=$this->data['Popup']?>
test
</div>
<script type="text/javascript">
setInterval("_checkUS2PopUpUpdate()", 12000); //12 seconds (debugging - change back to 50)
</script>
所以,每12秒,就有一個Ajax調用
function _checkUS2PopUpUpdate()
{
var callback=new Object();
callback.success=this.onExternalSuccess;
callback.failure=this.onExternalFailure;
YAHOO.util.Connect.asyncRequest('GET','/ci/ajaxCustom/ajaxUS2CheckPopupUpdate',callback);
};
function onExternalSuccess (o){
if(o.responseText!==undefined)
{
var str=o.responseText;
//document.getElementById('updateContent').innerHTML=str;
if(str !== 'no update2') // Then pop up.
{
// This code is valid for jQuery-ui but it is not working. I think jQuery is being imported somewhere else and overwriting
// jQuery-ui - I have set it back to the original popup for now - Matt Drewery
$.noConflict();
$.get('/euf/assets/announcements/pop_up_announcement_us2.html', function(data) {
$('#popupDialog').html(data);
$('#popupDialog').dialog({modal: true});
});
/*L=screen.width-200;
T=screen.height;
popup=window.open(str,"",'alwaysRaised=yes,status=no,toolbar=no,location=no,menubar=no,directories=no,resizable=no,scrollbars=no,height=200,width=330,left="+L+",top="+T');
for (i=0;i<200;i++)
{
T=T-1;
popup.moveTo(L,T);
}*/
}
}
}
當有人發消息,它調用加載HTML文件,並嘗試通過使用JQuery UI對話框彈出
但是,我得到了一個突破錯誤。我不知道如何走得更遠。謝謝。
$( [Break On This Error] $('#popupDialog').dialog({modal: true});
我會的,謝謝提醒。 – QLiu 2011-03-18 16:33:15