javascript

位置:IT落伍者 >> javascript >> 浏览文章

JS实现仿新浪信息提示效果


发布日期:2023年06月25日
 
JS实现仿新浪信息提示效果
<!DOCTYPEhtmlPUBLIC//WC//DTDXHTMLTransitional//ENtransitionaldtd>

<htmlxmlns=xml:lang=zhCNlang=zhCN>

<head>

<metaname=verifyvcontent=PTfFCiPVxqMWZeztyXVzMHlnwDwLQOqLBHNY=/>

<title>政策文件_中国电力工程造价信息网</title>

<metahttpequiv=ContentTypecontent=text/html;charset=gb/>

<metahttpequiv=ContentLanguagecontent=gb/>

<metaname=KeyWordscontent=电力工程造价价格信息装材设备电力工程/>

<metaname=descriptioncontent=电力工程造价信息/>

<styletype=text/css>

*{

margin:;padding:;

}

</style>

</head>

<body>

<divclass=cecmbodyid=cecmpolicy>

<divclass=leftClass>

<ahref=;网页教学网</a>

<inputtype=buttonvalue=点击这里onclick=sAlert(hello);/>

</div>

<divclass=rightClass>

</div>

</div>

<scripttype=text/javascriptlanguage=javascript>

//Author:Daviv

//Blog:

//Date:

//Email:

functionsAlert(str){

varmsgwmsghbordercolor;

msgw=;//提示窗口的宽度

msgh=;//提示窗口的高度

titleheight=//提示窗口标题高度

bordercolor=#;//提示窗口的边框颜色

titlecolor=#CCFF;//提示窗口的标题颜色

varsWidthsHeight;

sWidth=documentbodyoffsetWidth;

sHeight=screenheight;

varbgObj=documentcreateElement(div);

bgObjsetAttribute(idbgDiv);

bgObjstyleposition=absolute;

bgObjstyletop=;

bgObjstylebackground=#;

bgObjstylefilter=progid:DXImageTransformMicrosoftAlpha(style=opacity=finishOpacity=;

bgObjstyleopacity=;

bgObjstyleleft=;

bgObjstylewidth=sWidth+px;

bgObjstyleheight=sHeight+px;

bgObjstylezIndex=;

documentbodyappendChild(bgObj);

varmsgObj=documentcreateElement(div)

msgObjsetAttribute(idmsgDiv);

msgObjsetAttribute(aligncenter);

msgObjstylebackground=white;

msgObjstyleborder=pxsolid+bordercolor;

msgObjstyleposition=absolute;

msgObjstyleleft=%;

msgObjstyletop=%;

msgObjstylefont=px/emVerdanaGenevaArialHelveticasansserif;

msgObjstylemarginLeft=px;

msgObjstylemarginTop=+documentdocumentElementscrollTop+px;

msgObjstylewidth=msgw+px;

msgObjstyleheight=msgh+px;

msgObjstyletextAlign=center;

msgObjstylelineHeight=px;

msgObjstylezIndex=;

vartitle=documentcreateElement(h);

titlesetAttribute(idmsgTitle);

titlesetAttribute(alignright);

titlestylemargin=;

titlestylepadding=px;

titlestylebackground=bordercolor;

titlestylefilter=progid:DXImageTransformMicrosoftAlpha(startX=startY=finishX=finishY=style=opacity=finishOpacity=);;

titlestyleopacity=;

titlestyleborder=pxsolid+bordercolor;

titlestyleheight=px;

titlestylefont=pxVerdanaGenevaArialHelveticasansserif;

lor=white;

titlestylecursor=pointer;

titleinnerHTML=关闭;

titleonclick=function(){

documentbodyremoveChild(bgObj);

documentgetElementById(msgDiv)removeChild(title);

documentbodyremoveChild(msgObj);

}

documentbodyappendChild(msgObj);

documentgetElementById(msgDiv)appendChild(title);

vartxt=documentcreateElement(p);

txtstylemargin=em

txtsetAttribute(idmsgTxt);

txtinnerHTML=str;

documentgetElementById(msgDiv)appendChild(txt);

}

</script>

</body>

</html>

上一篇:用JavaScript编写程序实现文本滚动

下一篇:javascript弹出窗口问题总结