比较来自不同输入字段的两个值

时间:2015-08-04 10:13:00

标签: javascript jquery html button input

我尝试将一个小输入表单作为一个小项目。以下是两个输入字段中的HTML:

<?php

        function getSubObj($string, $verb) {

            $parts  = explode(" ", $string);
            $pos    = array_search($verb, $parts);

            foreach($parts as $key => $value) {

                if($key < $pos) {

                    $subjects[] = $value;

                } elseif($key > $pos) {

                    $objects[]  = $value;

                }

            }

            return array($subjects, $objects);

        }

        list($subjects, $objects) = getSubObj("Brother see the moon", "see");

        echo "<h2>Subjects</h2>";
        foreach($subjects as $item) {
            echo "$item ";
        }

        echo "<h2>Objects</h2>";
        foreach($objects as $item) {
            echo "$item ";
        }


?>

以下是我编写的代码,用于比较每个字段的两个值:

Password:<br>
<input type="text" name="password" em-pattern="^(?=.*\d)(?=.*[a-z])(?=.*[\!\@\#\$\%\^\&\*\(\)\_\+])(?=.*[A-Z]).{4,}$" class="password">
<br>
Repeat password:<br>
<input type="text" name="rpassword" class = "rpassword">
<br>

虽然语法正确,但在到达if比较时仍会返回错误。任何人都有任何想法为什么会发生这种情况? 接受的密码是大写,小写,数字和特殊字符。

0 个答案:

没有答案