小编War*_*ick的帖子

JavaScript - 如何在Mouseover/Mouseout上同时更改TR中所有TD的背景颜色?

当我mouseover连续一个TD时,我希望所有TD同时改变背景颜色,然后反向开启mouseout.

我该怎么做呢?

javascript css xhtml

8
推荐指数
3
解决办法
5万
查看次数

Bcrypt 哈希检查不起作用

我尝试使用两种不同的包装器,即password_compatBcrypt来加密我的密码。哈希保存得很好,但检查比较永远不匹配。

我使用以下代码来存储哈希密码:

//include ( "Bcrypt.php" );
include ( "password_compat-master/lib/password.php" );

if ( isset ( $_POST["username"] ) and isset ( $_POST["email"] ) and isset ( $_POST["password"] ) )
{

$username = $_POST["username"];
$password = $_POST["password"];
$email = $_POST["email"];

//$hash = Bcrypt::hash( $password );
$hash = password_hash( $password , PASSWORD_BCRYPT ); //password_compat function

$connect = mysqli_connect( "server" , "user", "pass" , "database" );

//Code to generate next database key ($next)

$sql_insert = "INSERT INTO `use_users` (`UserID`,`Username`,`Password`,`EmailAddress`) VALUES('$next','$username','$hash','$email');";
$res_insert …
Run Code Online (Sandbox Code Playgroud)

php mysql hash mysqli bcrypt

2
推荐指数
1
解决办法
2351
查看次数

如何使用jQuery $ .post()将数组发送到PHP

我想使用jQuery的$ .post()将数据发送到PHP页面,$_POST结果如下所示:

Array
(
    [text] => Some String
    [numbers] => Array
        (
            [0] => 9
            [1] => 4
        )

)
Run Code Online (Sandbox Code Playgroud)

成为numbers数组的信息是动态生成的,所以我不知道它将包含多少个元素.所以,我必须将这些信息收集到一个JavaScript数组中.

到目前为止我有这个jQuery代码:

$.post("http://some.url/page.php",
{
    text: $("#string").val(),
    numbers: $("#container input").val() //This is obviously wrong!
}).done(function (result)
{
    $("#result").html(result);
});
Run Code Online (Sandbox Code Playgroud)

我如何从价值input中的元素#container到在一个阵列numbers:点,以获得内的阵列$_POST阵列?

编辑: HTML看起来像这样:

<input type="text" name="text" id="text">
<div id="container">
    <label id="9"><input type="hidden" value="9">You added no. 9!</label>
    <label id="4"><input type="hidden" value="4">You added no. 4!</label>
    <!-- These inputs are dynamically added with …
Run Code Online (Sandbox Code Playgroud)

javascript php arrays jquery

-2
推荐指数
1
解决办法
642
查看次数

标签 统计

javascript ×2

php ×2

arrays ×1

bcrypt ×1

css ×1

hash ×1

jquery ×1

mysql ×1

mysqli ×1

xhtml ×1