0
我的JavaScript代碼替換Div
標籤...彈出關閉後如何顯示成功消息?
<script type="text/javascript">
function showPopup(url) {
newwindow=window.open(url,'Image
Share','height=490,width=850,top=200,left=80,resizable');
if (window.focus) {newwindow.focus()}
}
function replace() {
document.getElementById("div1").style.display="none";
document.getElementById("div2").style.display="block";
}
</script>
<div id = "div1" style="display:block" onclick = "replace()">
123123123
</div>
<div id = "div2" style="display:none">454545454 </div>
這一工程,但只有當我做一次。如果我重複這樣在同一頁上:
<!-- -------1------- -->
<div id = "div1" style="display:block" onclick = "replace()">
123123123
</div>
<div id = "div2" style="display:none">454545454 </div>
<!-- -------2------- -->
<div id = "div1" style="display:block" onclick = "replace()">
123123123
</div>
<div id = "div2" style="display:none">454545454 </div>
<!-- -------3------- -->
<div id = "div1" style="display:block" onclick = "replace()">
123123123
</div>
<div id = "div2" style="display:none">454545454 </div>
然後它不工作。我有超鏈接"div1"
。我想在彈出窗口關閉後替換它,並用成功消息替換它,或者在彈出窗口打開後禁用超鏈接。