当前位置: 首页 > news >正文

Js-JavaScript-三种弹出提示框-alert-confirm-prompt-ai插件

文章目录

    • 1.alert-提示框
    • 2.confirm-确认框
    • 3.prompt-输入框
    • 4.总结

1.alert-提示框

alert (message: string , title: string , errorIcon: Boolean )
Core JavaScript Classes
Displays an alert box
message: Data Type: string
The text to display
title (optional): Data Type: string
The title of the alert; ignored on the Macintosh
errorIcon (optional): Data Type: Boolean , Default Value: false
Display an Error icon; ignored on the Macintosh

弹出一个提示框,只有一个确定按钮。

alert("知了插件");

如下图所示:
在这里插入图片描述

2.confirm-确认框

confirm (message: string , noAsDefault: Boolean , title: string ): Boolean
Core JavaScript Classes
Displays an alert box with Yes and No buttons; returns true for Yes
message: Data Type: string
The text to display
noAsDefault (optional): Data Type: Boolean , Default Value: false
Set to true to set the No button as the default button
title (optional): Data Type: string
The title of the alert; ignored on the Macintosh

弹出一个确认框,选择Yes返回true,选择No放回false。

function test(){var rlt=confirm ("是否继续?", true, "提示");$.writeln (rlt);
}
test();

如下图所示:
在这里插入图片描述

3.prompt-输入框

prompt (prompt: string , default: string , title: string ): string
Core JavaScript Classes
Displays a dialog allowing the user to enter text
Returns null if the user cancelled the dialog, the text otherwise
prompt: Data Type: string
The text to display
default (optional): Data Type: string
The default text to preset the edit field with
title (optional): Data Type: string
The title of the dialog;

用户取消返回null,确认返回对应文本对象。

function test(){var rlt=prompt ("输入宽度:", "10", "提示");$.writeln (rlt);
}
test();

如下图所示:
在这里插入图片描述

4.总结

通过这三种方式,可以简单实现与程序的交互控制。

http://www.xdnf.cn/news/845371.html

相关文章:

  • 值得分享的几个免费数据采集软件
  • 一个古诗文起名工具
  • Hash的基本原理
  • 三维弹球c++求解
  • win7安装camera raw13.0.2详解。
  • VMware虚拟机磁盘分区图文教程
  • 全球十大顶尖压缩机制造强国
  • XSKY 亮相中国移动智算存储论坛,共话 AI 存储创新之路
  • 我对InfoQ中文站的期望
  • CANVAS游戏开发思路
  • 零基础学习CSS3 - 3D转换: 手把手教您实现各种高级特效
  • 【控制】基于 PID 控制器控制直流电机速度simulink实现
  • 接口测试平台-51:自动异常测试-5
  • flash详解
  • C的琐碎
  • 图像及视频基础知识
  • tomcat下中文的彻底解决[转]
  • 用VAE生成图像
  • 【医生的黑色幽默】都是医生亲口说的
  • 白帽子如何快速挖到人生的第一个漏洞 | 购物站点挖掘商城漏洞
  • 佛教礼仪
  • CVPR 2019 论文汇总(按方向划分,0409 更新中)[转载]
  • PAG 动效方案使用总结
  • 我在成都火车站捡了个彝族美女 第5节:好色多疑装好心
  • 什么是Silverlight?
  • webgame开发简明教程
  • 成品短视频app源码搭建教程,带你一步步实现开发
  • 教你挑选成品短视频App源码的5大关键要素
  • 2020 Jiangsu Collegiate Programming Contest(C,D,H,I,J)
  • 微软面试58道逻辑面试题