SoFunction
Updated on 2025-04-06

JavaScript implements a closed warning bar on top of IE

The function is very practical and the code is very simple. I don’t have much nonsense. I just offer it:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http:///TR/xhtml1/DTD/">
<html xmlns="http:///1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ImitationIEWarning bar at the top,Can be closed</title>
<style type="text/css">
#informationbar{
position: fixed;
left: 0;
width: 100%;
text-indent: 5px;
padding: 5px 0;
background-color: lightyellow;
border-bottom: 1px solid black;
font: bold 12px Verdana;
}
* html #informationbar{ /*IE6 hack*/
position: absolute;
width: expression(=="CSS1Compat"? +"px" : +"px");
}
</style>
<script type="text/javascript">
function informationbar(){
="always"
='<a href="javascript:()"><img src="" style="width: 14px; height: 14px; float: right; border: 0; margin-right: 5px"

/></a>'
}
=function(data){
=+data
('<div  style="top: -500px">'++'</div>')
}
=function(){
var barinstance=this
if (parseInt()<0){
=parseInt()+5+"px"
setTimeout(function(){()}, 50)
}
else{
if ( && !)
("top", '=="CSS1Compat"? +"px" : +"px"')
else
=0
}
}
=function(){
("informationbar").="none"
if (=="session")
="infobarshown=1;path=/"
}
=function(type){
=type
}
=function(){
if (=="session" && ("infobarshown")==-1 || =="always"){
=("informationbar")
=parseInt()
=*(-1)+"px"
()
}
}
=function(){
=null
}
</script>
<script type="text/javascript">
<!--Invocation code-->
var infobar=new informationbar()
('Guess:Tomorrow at noon12Money rain falls from the sky,Please prepare sacks!  &lt;a href="#">Buy sack</a><a href="#">Buy sack</a>')()
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt;

The above is the entire content of this article, I hope you like it.