日期:2014-05-16  浏览次数:20359 次

偶没分了,求一个JS代码.
不知道大家有没有用过新浪邮箱.

我想要一像他那样的经过美化的   confirm   的对话框,而不是原始的那种样式的.

谁有的话共享一下,谢谢.

------解决方案--------------------
靠,要求还真高....
-------------------------------
<!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> 无标题文档 </title>
<script language= "javascript ">
function doOK(isOK){
document.body.removeChild(alertFram);
if(isOK){
//点击确认后执行的代码
document.getElementById( 'showdlg ').value= '你已经确认了 ';
}
else
{
//点击取消后执行的代码
document.getElementById( 'showdlg ').value= '你已经取消了 ';
}
}

function showDialog(){
var alertFram = document.createElement( "DIV ");
alertFram.id= "alertFram ";
alertFram.style.position = "absolute ";
alertFram.style.left = "50% ";
alertFram.style.top = "50% ";
alertFram.style.marginLeft = "-225px " ;
alertFram.style.marginTop = -75+document.documentElement.scrollTop+ "px ";
alertFram.style.width = "450px ";
alertFram.style.height = "150px ";
alertFram.style.background = "#ccc ";
alertFram.style.textAlign = "center ";
alertFram.style.lineHeight = "150px ";
alertFram.style.zIndex = "10001 ";

strHtml = " <ul style=\ "list-style:none;margin:0px;padding:0px;width:100%\ "> \n ";
strHtml += " <li style=\ "background:#DD828D;text-align:left;padding-left:20px;font-size:14px;font-weight:bold;height:25px;line-height:25px;border:1px solid #F9CADE;\ "> [系统提示] </li> \n ";
strHtml += " <li style=\ "background:#fff;text-align:center;font-size:12px;height:120px;line-height:120px;border-left:1px solid #F9CADE;border-right:1px solid #F9CADE;\ "> 这是一个测试 </li> \n ";
strHtml += " <li style=\ "background:#FDEEF4;text-align:center;font-weight:bold;height:25px;line-height:25px; border:1px solid #F9CADE;\ "> <input type=\ "button\ " value=\ "确 定\ " id=\ "do_OK\ " onclick=\ "doOK(true)\ " /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type=\ "button\ " value=\ "取 消\ " id=\ "do_Cancel\ " onclick=\ "doOK(false)\ " /> </li> \n ";
strHtml += " </ul> \n ";
alertFram.innerHTML = strHtml;
document.body.appendChild(alertFram);
}
</script>
</head>

<body>
<input type= "button " id= "showdlg " value= "显示对话框 " onclick= "showDialog() "/>
</body>
</html>