Home >Web Front-end >JS Tutorial >JavaScript message box effect [implementation code]_javascript skills

JavaScript message box effect [implementation code]_javascript skills

WBOY
WBOYOriginal
2016-05-16 15:03:301223browse

Warning box

alert();

Confirmation box

var message=confirm("你喜欢javascript吗");
if(message==true){
  document.write("很好,加油");
}else{
  document.write("js功能强大,要学习哦");
}

Question Box

prompt("text","default value");

var myname=prompt(请输入你的姓名);
if(myname!=null){
  alert("你好"+myname);
}else{
  alert("你好我的朋友");
}

The above JavaScript message box effect [implementation code] is all the content shared by the editor. I hope it can give you a reference, and I hope you will support Script Home.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn