How can phpstrom run with html.php and js code at the same time?
疯骨
疯骨 2020-02-09 10:10:15
0
0
723

<!DOCTYPE html>
<html>
<head lang="en">
   <meta charest=""UTF-8>
       <title></title>
   <script src="jquery-3.0.0.js" type="text/javascript"> </script>
   </head>
<body>
<?php
   $str = '';
   $str.='<span style="color:rgb('.mt_rand(0,255).',
   '.mt_rand(0,255).','.mt_rand(0,255).')
   ">'.mt_rand(0,9).'<span>';
   $str.='<span style="color:rgb('.mt_rand(0,255).',
   '.mt_rand(0,255).','.mt_rand(0,255).')
   ">'.mt_rand(0,9).'<span>';
   $str.='<span style="color:rgb('.mt_rand(0,255).',
   '.mt_rand(0,255).','.mt_rand(0,255).')
   ">'.mt_rand(0,9).'<span>';
   $str.='<span style="color:rgb('.mt_rand(0,255).',
   '.mt_rand(0,255).','.mt_rand(0,255).')
   ">'.mt_rand(0,9).'<span>';
   //echo $str;
?>
<label for="check">请输入验证码:</label>
<div id="hiddent_val" style="display: none;"><?php echo $str ?></div><!--//生成的随机数,指定一个style不显示但其实实际存在,给他一个id获取这个id值获取到这个值说明也就获取到了输入框里的值-->
<input type="text" name="check" id="check_val"><?php echo $str; ?>
<br/>
<input type="button" onclick="javascript:check();" value="提交">
<script>
   function check() {
       var v1=$("#hiddent_val").text();/*//得到的是随机验证码的值,本来是字符型*/
       v1 = v1*1;//转成数值类型
       var v2=$("#check_val").val();/*//同理*/
       v2 = v2*1;
       if(v1==v2){
           alert('OK');
       }else{
           alert('false');
       }

   }
</script>
</body>
</html>

疯骨
疯骨

reply all(0)
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!