Similar to the effect of the Sina mailbox hints. More independent. With the help of the wenming moderator, the highly adaptable bug has been solved.
The use of the method is very simple, in the need to pop-up prompts the page first
<script type= "Text/javascript" src= "Alert.js" ></script>
It is then used directly at the point of need:
Salert ("Information to be prompted")
To complete the full effect. You do not need to add any other code to the page.
Run Code Box
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "><ptml xmlns=" http://www.w3.org/1999/xhtml "xml:lang=" ZH-CN "lang=" ZH-CN "><pead><meta name=" Verify-v1 "content=" p4t6ffcipvxqmwz2eztyxvzmhlnwd0wlqoq6lbhn5y8= "/><title> policy Document _ China Power Engineering cost Information Network </title ><meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/><meta http-equiv=" Content-language "content=" gb2312 "/><meta name=" KeyWords "content=" Power engineering Cost, price information, loading, equipment, Power engineering "/><meta name=" description "content=" Power Engineering cost information/><style type= "Text/css" > *{ margin:0;padding:0; }</style></pead><body><div class= "Cecmbody" id= "Cecmpolicy" ><div class= "LeftClass" > <p> Test </p><p> Test </p><p> Test </p><p> Test </p><p> test </p><p > Test </p><p> Test </p><p> Test </p><p> Test </p><p> test </p><p> Test </p><p> Test </p><p> Test </p><p> Test </p><p> test </p>< Input type= "button" value= "click here"/></div><div class= "Rightclass" ></div></div><script Type= "Text/javascript" language= "JavaScript" >//author:daviv//blog:http://blog.163.com/jxdawei//date : 2006-10-27//email:jxdawei@gmail.comfunction Salert (str) {var msgw,msgh,bordercolor;msgw=400;//hint window width msgh=100;// Tip Window Height titleheight=25//Prompt window caption height bordercolor= "#336699";//Prompt window border color titlecolor= "#99CCFF";//Hint window title color var swidth, Sheight;swidth=document.body.offsetwidth;sheight=screen.height;var bgobj=document.createelement ("div"); Bgobj.setattribute (' id ', ' bgdiv '); bgobj.style.position= "Absolute"; bgobj.style.top= "0"; bgobj.style.background= "# 777 "bgobj.style.filter=" Progid:DXImageTransform.Microsoft.Alpha (style=3,opacity=25,finishopacity=75); bgobj.style.opacity= "0.6"; bgobj.style.left= "0"; Bgobj.style.width=swidth + "px"; bgobj.style.height=sheight + "px"; BgObj.style.zIndex = "100;d Ocument.body.appendChild (bgobj); var msgobj=document.createelement ("div") Msgobj.setattribute ("id", "msgdiv") ; Msgobj.setattribute ("Align", "center"); msgobj.style.background= "White"; msgobj.style.border= "1px solid" + bordercolor; MsgObj.style.position = "absolute"; MsgObj.style.left = "50%"; MsgObj.style.top = "50%"; Msgobj.style.font= "12px/1.6em Verdana, Geneva, Arial, Helvetica, Sans-serif"; MsgObj.style.marginLeft = " -225px"; MsgObj.style.marginTop = -75+document.documentelement.scrolltop+ "px"; MsgObj.style.width = MSGW + "px"; MsgObj.style.height =msgh + "px"; msgObj.style.textAlign = "center"; MsgObj.style.lineHeight = "25px"; MsgObj.style.zIndex = "10001"; var title=document.createelement ("H4"); Title.setattribute ("id", "msgtitle"); Title.setattribute ("Align", "right"); title.style.margin= "0"; Title.style.padding= "3px"; Title.style.background=bordercolor; Title.style.filter= "Progid:DXImageTransform.Microsoft.Alpha (startx=20, starty=20, finishx=100, finishy=100,style= 1,OPACITY=75,FINISHOPACITY=100); "; Title.style.opacity= "0.75"; Title.style.border= "1px solid" + bordercolor; Title.style.height= "18px"; Title.style.font= "12px Verdana, Geneva, Arial, Helvetica, Sans-serif"; title.style.color= "White"; title.style.cursor= "Pointer"; Title.innerhtml= "Close"; Title.onclick=function () {document.body.removeChild (bgobj); document.getElementById ("Msgdiv"). RemoveChild (title); Document.body.removeChild (Msgobj); } document.body.appendChild (Msgobj); document.getElementById ("Msgdiv"). AppendChild (title); var txt=document.createelement ("P"); Txt.style.margin= "1em 0" Txt.setattribute ("id", "msgtxt"); TXT.INNERHTML=STR; document.getElementById ("Msgdiv"). appendchild (TXT); }</script></body></ptml>
[Ctrl + A ALL SELECT hint: You can modify some of the code, and then run]