我需要執行一些警報消息(如驗證等),我正在使用DIV執行此操作。此DIV未在Internet Explorer上顯示
這就是我正在做的驗證:
<form action="index.php" method="post" onsubmit="return validateSearchKeyword();">
<input class="text_search" id="text_search" name="text_search" type="text" value="pesquisar" onfocus="if (this.value=='pesquisar') this.value = ''" onBlur="if (this.value=='') this.value = 'pesquisar'" />
</form>
和驗證功能:
function validateSearchKeyword()
{
if (document.getElementById('text_search').value==""){creatediv('divAvisoPesquisa','You must supply a value', '355px', '125px');return false;}
}
這是函數來創建DIV:
function creatediv(id, html, left, top) {
if (document.getElementById(id))
{
//document.getElementById(id).style.display='block';
//fadeIn(id, 300);
}
else
{
var newdiv = document.createElement('div');
newdiv.setAttribute('id', id);
newdiv.setAttribute("class", "warningDiv");
newdiv.style.position = "absolute";
newdiv.innerHTML = html;
newdiv.style.left = left;
newdiv.style.top = top;
newdiv.style.display = "none";
newdiv.onclick=function(e) {
$(this).fadeOut(300, function() { $(this).remove(); });
};
document.body.appendChild(newdiv);
$("#"+id).fadeIn(300);
}
}
的fadIn and fadeOut個功能是從 「jQuery的1.3.1.min.js」
的CSS ...
.warningDiv{
-moz-border-radius-bottomleft:15px;
-moz-border-radius-bottomright:15px;
-moz-border-radius-topleft:15px;
-moz-border-radius-topright:15px;
font-size:11px;
font-weight:bold;
height:55px;
padding:15px 25px;
width:320px;
z-index:100000;
display: block;
}
所以,這是對所有的瀏覽器除了IE偉大的工作。即使是驗證工作(表單在未通過驗證時也未提交),但未顯示DIV。 我該如何解決這個問題?
感謝
你能更具體地提供IE版本嗎?還是每個版本都會發生? – RuudKok 2009-02-18 15:41:25
我正在測試它與IE 7 – RSilva 2009-02-18 15:49:58