Example of three popup alert codes

Source: Internet
Author: User

?
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 66676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "http://www.w3.org/1999/xhtml">  <meta http-equiv="Content-Type"content="text/html; charset=gb2312"/> <title>三种弹出对话框的用法实例</title> <script language="javascript">  functionale() {         //这个基本没有什么说的,就是弹出一个提醒的对话框     alert("我敢保证,你现在用的是演示一"); } function firm() {         //利用对话框返回的值 (true 或者 false)     if(confirm("你确信要转去风亦飞的博客?"))     {             //如果是true ,那么就把页面转向thcjp.cnblogs.com         location.href="http://blog.csdn.net/fengyifei11228/";      }     else     {         //否则说明下了,赫赫       alert("你按了取消,那就是返回false");     }  } functionprom() {     varname=prompt("请输入您的名字","");//将输入的内容赋给变量 name ,      //这里需要注意的是,prompt有两个参数,前面是提示的话,后面是当对话框出来后,在对话框里的默认值     if(name)//如果返回的有内容     {          alert("欢迎您:"+ name)      } } </script>    <body> <p>对话框有三种</p> <p>1:只是提醒,不能对脚本产生任何改变;</p> <p>2:一般用于确认,返回 true或者 false,所以可以轻松用于 ifelse判断 </p> <p>3: 一个带输入的对话框,可以返回用户填入的字符串,常见于某些留言本或者论坛输入内容那里的 插入UBB格式图片 </p> <p>下面我们分别演示:</p>  <p>演示一:提醒 对话框</p> <p>   <input type="submit"name="Submit"value="提交"onclick="ale()"/> </p> <p>演示二 :确认对话框 </p> <p>   <input type="submit"name="Submit2"value="提交"onclick="firm()"/> </p> <p>演示三 :要求用户输入,然后给个结果</p> <p>   <input type="submit"name="Submit3"value="提交"onclick="prom()" /> </p><span class="btn btn-danger"id="refundstatus"onclick="javascript:if(confirm(‘确认提交‘))location=‘/fmd/refund/change?num={{$v[‘order_number‘]}}‘">后续操作</span><span class="btn btn-primary"id="refundstatus" onclick="javascript:if(alert(‘无法进行后续操作‘));">无后续操作</span> </body> 

Example of three popup alert codes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.