小编Lul*_*ulu的帖子

如何设置href?

我有一个按钮,当按下时必须从外部php文件调用函数并将其加载到新页面.

当我点击index.php页面上的"SHOW"按钮时,它会在"mesaj"中显示消息,但会在index.php页面中显示(我不想要!).

我想要完成的是当我点击index.php上的"SHOW"按钮时,它会将消息的内容显示到另一个php页面中,名为 - 例如 - content.php.我想设置href.

的index.php

<input type = "button" class="btn btn-primary" id = "show" onClick = "show()" value = "SHOW"/>
Run Code Online (Sandbox Code Playgroud)

的functions.php

function show()
{

    database();

    $sql = "SELECT title FROM `Articles`";

    $titleSql = mysql_query( $sql ) or die("Could not select articles:");

    $html = '<html><body><div class="container"><h2>Basic List Group</h2><ul class="list-group">';

    while ($title = mysql_fetch_array($titleSql)) {
        $html .= '<li class="list-group-item">'.$title["title"].'</li>';
    }

    $html .= '</ul></div></body></html>';

    echo $html;
    //die(json_encode(array("mesaj" => "Entered data successfully ")));

}
Run Code Online (Sandbox Code Playgroud)

function.js

function show(){
        var n = $('#show').val() …
Run Code Online (Sandbox Code Playgroud)

javascript php jquery html5 href

5
推荐指数
1
解决办法
146
查看次数

parens如何运作?

我在老师的笔记中找到了一段代码,我不明白.关键是要找到函数返回TRUE的"pass"值.你能否回答下面我的问题(评论),所以我能理解这是如何运作的?

<script type="text/javascript">

function findPassword(pass)
{
    var b = 1337

//How is this function returning "min" (without the parens?)

function add(x){
    b += 84
    return min
}

//Same question as above...for "mod" - how is this compiling? 

function min(x){
    b -= 123
    return mod
}

function div(x){
    b /= 3
    return min
}

function mod(x){
    b = b+5+(b%3)
    return add
}

//what is the purpose of "fn" if it is not used at all?

var fn = function ()
{ …
Run Code Online (Sandbox Code Playgroud)

javascript function

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

PHP最短的正则表达式为空字符串

我想找到最短的正则表达式模式来匹配一个空字符串(没有空格或任何东西)

我已经找到

 /(\d|)/    (7chars)
and '^[\s]*$' (9 chars)
Run Code Online (Sandbox Code Playgroud)

直到现在.

php preg-match shortest

-4
推荐指数
1
解决办法
467
查看次数

标签 统计

javascript ×2

php ×2

function ×1

href ×1

html5 ×1

jquery ×1

preg-match ×1

shortest ×1