我已經花了最近兩天對這個話題進行研究。我需要在加載頁面時顯示一個彈出窗口,但是隻有在加載頁面後才能顯示它。如何在頁面加載時創建彈出窗口?
的彈出(在.js文件)的代碼的頁面加載 即使我調用JSP文件頭中的js代碼執行後,它仍然顯示後的頁面加載。但是,如果我在調用jsp之後在jsp文件中放置了一個「alert」腳本,它將在頁面加載之前執行,而不是彈出窗口。
爲彈出的JavaScript代碼具有這樣的結構:
中的.jsp的代碼是這樣的:
//... some code
<div class="introSection">
<div class="header">
<header>
<hdgroup>
<h1>Welcome to myPage.</h1>
</hdgroup>
<jwr:script src="/javascript/bundles/jquery-1.6.1.min.js" useRandomParam="false" />
<jwr:script src="/javascript/bundles/homePage.js" useRandomParam="false" />
<jwr:script src="/javascript/bundles/mobilePopup.js" useRandomParam="false" />
<script language="javascript">alert("This alert is placed after the popup code is called in the header, but it's showed before");</script>
</header>
</div>
<ul>
//more code
</ul>
//more code
任何建議有關可能的解決方案?
'jQ' ='jQuery'?如果是,請將標籤添加到您的問題。另外,顯示相關的錯誤消息。 –