Home > Backend Development > PHP Tutorial > 输入特定的字符才能下载

输入特定的字符才能下载

WBOY
Release: 2016-06-23 14:13:20
Original
959 people have browsed it

就是点击下载的时候弹出一个对话框,输入密码,密码正确才能下载,不正确就不能下载,下面是我的一个测试,但效果没达到



<script> <br /> function _add() <br /> { var a=prompt("请输入密码进行验证:",""); <br /> if(a=="mima") { <br /> alert("你的输入正确!"); <br /> } <br /> else <br /> { <br /> alert("你的输入不正确!"); <br /> } <br /> } <br /> <br /> </script>
下载



这个弹出的窗口不管输入的对错,都下载了,如果我在onclick后面加上返回错误,弹出的窗口不管输入对错,都不能下载了,那位大哥给指点下,或是换一种方式实现效果

回复讨论(解决方案)




<script> <br /> function _add() <br /> { var a=prompt("请输入密码进行验证:",""); <br /> if(a=="mima") { <br /> alert("你的输入正确!"); <br /> } <br /> else <br /> { <br /> alert("你的输入不正确!"); <br /> return false; <br /> } <br /> } <br /> <br /> </script>
下载


楼上的,谢谢了

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template