這裏是我的Ajax請求:使用的Ajax.Updater得到一個JavaScript文件(prototypejs)
new Ajax.Updater({ success: 'footer' }, '/dyn/actions/checkSystemMessage', {
insertion: 'after',
evalScripts: true
});
這裏是在5 /達因/動作/ checkSystemMessage什麼:
<script type="text/javascript"><!--
document.observe('dom:loaded', function() {
buildSystemMsg = function(SystemMsg) {
//behind container
behindContainer = new Element('div', {id: 'behind-system-message'});
behindContainer.setStyle({display: 'none'});
document.body.appendChild(behindContainer);
//main container
container = new Element('div', {id: 'system-message'}).update(SystemMsg);
container.setStyle({display: 'none'});
document.body.appendChild(container);
//hide button
hideBtn = new Element('a', {'class': 'close-button', 'title': 'Close System Message'}).update('Close');
hideBtn.setStyle({ marginTop: '5px'});
container.insert({bottom: hideBtn});
offsetY = container.getHeight();
//show
if ($('mod-system-alert'))
{ new Effect.Move($('mod-system-alert'), { queue: 'front', x: 0, y: offsetY, mode: 'relative', duration: 0 }); }
new Effect.Move($('footer'), { queue: 'front', x: 0, y: offsetY, mode: 'relative', duration: 0 });
new Effect.Move($('page-container'), { queue: 'front', x: 0, y: offsetY, mode: 'relative', duration: 0 });
new Effect.Move($('nav'), { queue: 'front', x: 0, y: offsetY, mode: 'relative', duration: 0 });
new Effect.Move($('header-container'), { queue: 'front', x: 0, y: offsetY, mode: 'relative', duration: 0 });
Effect.BlindDown(behindContainer, { queue: 'front', duration: 0 });
Effect.BlindDown(container, { queue: 'end', duration: 0.5 });
hideBtn.observe('click', function() {
if ($('mod-system-alert'))
{ new Effect.Move($('mod-system-alert'), { queue: 'front', x: 0, y: -offsetY, mode: 'relative', duration: 0 }); }
new Effect.Move($('footer'), { queue: 'end', x: 0, y: -offsetY, mode: 'relative', duration: 0 });
new Effect.Move($('page-container'), { queue: 'end', x: 0, y: -offsetY, mode: 'relative', duration: 0 });
new Effect.Move($('nav'), { queue: 'end', x: 0, y: -offsetY, mode: 'relative', duration: 0 });
new Effect.Move($('header-container'), { queue: 'end', x: 0, y: -offsetY, mode: 'relative', duration: 0 });
Effect.BlindUp(behindContainer, { queue: 'front', duration: 0 });
Effect.BlindUp(container, { queue: 'front', duration: 0.5 });
set_cookie("HideSystemMsg", true);
});
}
hideMsg = get_cookie("HideSystemMsg");
systemMsg = '${SystemMsg}';
if (systemMsg.length > 0 && !hideMsg)
buildSystemMsg(systemMsg);
});
--></script>
這既不是插在具有ID頁腳的元素之後的javascript也不執行腳本。它確實依賴於發生更新的頁面上包含的其他JavaScript庫。這可能是我的問題在哪裏?
什麼是/ dyn/actions/checkSystemMessage的MIME類型? – TJMonk15 2009-12-01 20:40:04
application/x-javascript – Dustin 2009-12-03 16:32:31