我是靠谱客的博主 忧心鸡翅,这篇文章主要介绍JavaScript弹窗基础篇,现在分享给大家,希望可以做个参考。

confirm()意既确认框

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>confirm</title> </head> <body> <script> var con=confirm("do you like to study javascript?"); if (con) { document.write("I love javascript!"); } else{ document.write("I love other lanuages!"); } </script> </body> </html>

prompt意既消息提示框

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>confirm</title> </head> <body> <script> var pro=prompt("what is your name?"); document.write(pro); </script> </body> </html>

window.open(uri,name,attr)

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>confirm</title> </head> <body> <a href="#" title="http://www.cnblogs.com/yuzheCyril/">click me</a> <script> var link=document.getElementsByTagName("a")[0]; link.onclick=function(){window.open(link.title,"blog","width=400px,height=400px");} </script> </body> </html>

window.close()关闭窗口

以上所述是小编给大家介绍的JavaScript弹窗基础篇的相关内容,希望对大家有所帮助!

最后

以上就是忧心鸡翅最近收集整理的关于JavaScript弹窗基础篇的全部内容,更多相关JavaScript弹窗基础篇内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(147)

评论列表共有 0 条评论

立即
投稿
返回
顶部