html怎么在alert中加标题,HTML Window alert()用法及代码示例

窗口alert()方法用于显示警报框。它显示指定的消息以及“确定”按钮,通常用于确保信息通过用户。它返回一个字符串,该字符串表示要在警报框中显示的文本。

用法:

alert(message)

以下示例程序旨在说明窗口alert()方法:

显示警报框。

Window alert() Method in HTML

h1 {

color:green;

}

h2 {

font-family:Impact;

}

body {

text-align:center;

}

GeeksforGeeks

Window alert() Method

For displaying the alert message, double

click the "Show Alert Message" button:

Show Alert Message

function myalert() {

alert("Welcome to GeeksforGeeks.\n " +

"It is the best portal for computer" +

"science enthusiasts!");

}

输出:

ac6496ccafe0bc33d21e5acc5998431d.png

单击按钮后

76d2c6c156532ce3101f534caae6c7dd.png

支持的浏览器:下面列出了Window alert()方法支持的浏览器:

谷歌浏览器

IE浏览器

火狐浏览器

Opera

苹果浏览器

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值