Alert提示框备用

  
  
  
  Alert {
  /**通过buttonStyleName样式自定义Alert显示的按钮风格**/
  buttonStyleName: myCustomButtonStyleName;
  /**通过messageStyleName样式自定义Alert显示内容风格 **/
  messageStyleName: myCustomMessageStyleName;
  /**通过titleStyleName样式自定义Alert显示标题**/
  titleStyleName: myCustomTitleStyleName;
  /**通过backgroundAlpha, backgroundColor, borderAlpha和borderColor样式给Alert对话框设置背景颜色 **/
  backgroundAlpha: 0.3;
  backgroundColor: red;
  borderAlpha: 0.3;
  borderColor: red;
  dropShadowEnabled: false;
  creationCompleteEffect: myEffect;
  }
  .myCustomButtonStyleName {
  color: red;
  cornerRadius: 12;
  fontFamily: myComicSansMS;
  fontSize: 10;
  fontWeight: normal;
  textDecoration: underline;
  themeColor: red;
  }
  .myCustomMessageStyleName {
  color: haloOrange;
  fontFamily: myComicSansMS;
  fontSize: 10;
  fontWeight: normal;
  }
  .myCustomTitleStyleName {
  color: haloOrange;
  fontFamily: myComicSansMS;
  fontSize: 16;
  fontWeight: normal;
  }
  
  
  Flex中如何利用titleIcon和iconClass属性给Alert添加Icon图标的例子 **/
  alert = Alert.show(myMessage, myTitle, Alert.YES|Alert.NO, null, null, IconCritical);
  alert.titleIcon = BulletCritical;
  //改变默认可选按钮的显示标签和按钮宽度。
  // Alert.buttonWidth = 100;
  // Alert.yesLabel = "确定";
  // Alert.noLabel = "否";
  // Alert.cancelLabel = "取消";
  }
  ]]>
  
  
  
  
  
  
  
  
  
  
  -------------------------------------------------- ------------------------------------
  package
  {
  import flash.display.DisplayObject;
  import mx.controls.Alert;
  import mx.managers.PopUpManager;
  import flash.events.Event;
  public class AlertUtil
  {
  public function AlertUtil()
  {
  }
  public static function Prompt(msg:String,parent:DisplayObject):void{
  var alert:Alert = new Alert();
  alert.setStyle("messageStyleName","AlertMessage");
  alert.setStyle("titleStyleName","AlertTitle");
  alert.title = "提示";
  alert.text = msg;
  PopUpManager.addPopUp(alert,parent,true);
  PopUpManager.centerPopUp(alert);
  }
  public static function Confirm(msg:String,parent:DisplayObject,closeHandl er:Function){
  var alert:Alert = new Alert();
  alert.setStyle("messageStyleName","AlertMessage");
  alert.setStyle("titleStyleName","AlertTitle");
  alert.title = "操作确认";
  alert.text = msg;
  alert.addEventListener(Event.CLOSE,closeHandler);
  alert.buttonFlags = Alert.OK | Alert.CANCEL;
  alert.defaultButtonFlag = Alert.OK;
  PopUpManager.addPopUp(alert,parent,true);
  PopUpManager.centerPopUp(alert);
  }
  }
  }
  -------------------------------------------------- ----------------------------
  
  
  
  
  
  
  
  -------------------------------------------------- ------------------
  
  
  
  
  
  The quick brown fox jumped over the lazy dog.
  The quick brown fox jumped over the lazy dog.
  The quick brown fox jumped over the lazy dog?
  
  
  
  
  @font-face{
  src: url("./fonts/base02.ttf");
  fontFamily: "Base02";
  }
  Alert {
  titleStyleName: "alertTitle";
  messageStyleName: "alertMessage";
  buttonStyleName: "alertButton";
  dropShadowEnabled: true;
  shadowDistance: 5;
  shadowDirection: right;
  cornerRadius: 0;
  embedFonts: true;
  fontFamily: Base02;
  }
  .alertTitle {
  letterSpacing: 0;
  fontSize: 14;
  color: red;
  }
  .alertMessage {
  letterSpacing: 0;
  fontSize: 10;
  fontWeight: normal;
  color: black;
  }
  .alertButton {
  letterSpacing: 0;
  fontSize: 11;
  cornerRadius: 10;
  fontWeight: normal;
  textRollOverColor: white;
  color: red;
  skin: ClassReference(null);
  }
  
  
  
  
  
  
  
  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
alert提示框样式通常包括背景颜色、字体样式、边框样式等元素。在网页开发中,可以通过CSS样式来控制alert提示框的外观。 首先,我们可以使用`background-color`属性来定义背景颜色。例如,将背景颜色设置为黄色可以使用以下代码: ``` alert("提示信息"); ``` ``` <script> window.alert = function(msg) { var div = document.createElement("div"); div.style.backgroundColor = "yellow"; div.innerText = msg; document.body.appendChild(div); }; </script> ``` 其次,我们可以通过`font-family`和`font-size`属性来设置字体的样式和大小。例如,将字体样式设置为宋体、字体大小设置为16像素可以使用以下代码: ``` alert("提示信息"); ``` ``` <script> window.alert = function(msg) { var div = document.createElement("div"); div.style.fontFamily = "宋体"; div.style.fontSize = "16px"; div.innerText = msg; document.body.appendChild(div); }; </script> ``` 最后,我们可以使用`border`属性来设置边框样式。例如,将边框设置为红色实线可以使用以下代码: ``` alert("提示信息"); ``` ``` <script> window.alert = function(msg) { var div = document.createElement("div"); div.style.border = "1px solid red"; div.innerText = msg; document.body.appendChild(div); }; </script> ``` 综上所述,通过设置背景颜色、字体样式和边框样式等属性,我们可以自定义alert提示框的样式。当然,在实际开发中,我们可以根据需要添加更多的样式属性来实现不同的效果。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值