我需要执行一些警报消息(如验证等),我正在使用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