div_顯示隱藏簡單例子2(displayDiv.js)

function displayDiv()
{
var divColl = document.getElementById("sponsorAdDiv");
var divColl = document.all.tags("div");
 for (i=0; i<divColl.length; i++) {
           var whichEl = divColl(i);
            if (whichEl.id == "sponsorAdDiv") whichEl.style.display = "block";
       }

}

 


function hideDiv()
{
  var divColl = document.all.tags("div");
 for (i=0; i<divColl.length; i++) {
           var whichEl = divColl(i);
            if (whichEl.id == "sponsorAdDiv") whichEl.style.display = "none";
       }
}

 

引用頁面示例:

<%
  String strDiv = "<div id='sponsorAdDiv' style='left: 230px; top: 120px;position:relative;'>";
  strDiv = strDiv + "<table width='300' height='50' bgcolor='#0099cc' border=0 cellspacing=1>";
  strDiv = strDiv + "<tr><td><table width='100%' height='100%' border=0 cellspacing=0>";
  strDiv = strDiv + "<tr bgcolor='#d2e9fe'><td>&nbsp;&nbsp;&nbsp;&nbsp;";
  strDiv = strDiv + "系統正在進行操作,可能需要幾秒鐘<br>&nbsp;&nbsp;&nbsp;&nbsp;";
  strDiv = strDiv + "請您稍候......</td></tr></table></td></tr></table></div>";
  out.print(strDiv);
  out.print("<script type='text/javascript'>hideDiv();</script>");
%>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章