| <! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <Html xmlns = "http://www.w3.org/1999/xhtml"> <Head> <Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/> <Title> similar to the warning bar at the top of IE, you can disable it </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 (document. compatMode = "CSS1Compat "? Document.doc umentElement. clientWidth + "px": body. clientWidth + "px "); } </Style> <Script type = "text/javascript"> Function informationbar (){ This. displayfreq = "always" This. content = '<a href = "javascript: informationbar. close () "> /> </A>' } Informationbar. prototype. setContent = function (data ){ This. content = this. content + data Document. write ('<div id = "informationbar" style = "top:-500px">' + this. content + '</div> ') } Informationbar. prototype. animatetoview = function (){ Var barinstance = this If (parseInt (this. barref. style. top) <0 ){ This. barref. style. top = parseInt (this. barref. style. top) + 5 + "px" SetTimeout (function () {barinstance. animatetoview ()}, 50) } Else { If (document. all &&! Window. XMLHttpRequest) This. barref. style. setExpression ("top", 'document. compatMode = "CSS1Compat "? Document.doc umentElement. scrollTop + "px": body. scrollTop + "px "') Else This. barref. style. top = 0 } } Informationbar. close = function (){ Document. getElementById ("informationbar"). style. display = "none" If (this. displayfreq = "session ") Document. cookie = "infobarshown = 1; path = /" } Informationbar. prototype. setfrequency = function (type ){ This. displayfreq = type } Informationbar. prototype. initialize = function (){ If (this. displayfreq = "session" & document. cookie. indexOf ("infobarshown") =-1 | this. displayfreq = "always "){ This. barref = document. getElementById ("informationbar ") This. barheight = parseInt (this. barref. offsetHeight) This. barref. style. top = this. barheight * (-1) + "px" This. animatetoview () } } Window. onunload = function (){ This. barref = null } </Script> <Script type = "text/javascript"> <! -- Invocation code --> Var infobar = new informationbar () Infobar. setContent! <A href = "#"> buy sacks </a> <a href = "#"> buy sacks </a> ') Infobar. initialize () </Script> </Head> <Body> </Body> </Html> |