小编231*_*654的帖子

javascript isNaN() 函数不起作用?

我有一个函数来测试提示输入是否是数字,如下所示:

function myFunction() 
{
    var person = prompt("Please enter your name", "");

    if (person != null) 
    {
        if(isNaN(person))
        {
            document.write("hello " + person + "<br><br>");
        }
        else
            document.write("You gave me a number");

    }
    else
    {
        document.write("You didn't answer.<br><br>");
    }
}
Run Code Online (Sandbox Code Playgroud)

但每次我输入一个数字时,它都会不断输出 hello + 数字。我已经在谷歌上搜索这个函数很长一段时间了,它对我来说没有意义,看起来它应该有效。为什么人要返回true?

javascript

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

如何使用php中的print语句和图像功能每隔几秒刷新一次div

我正在尝试构建一个主要使用PHP的浏览器卡片游戏,也许还有一些其他有用的语言可以用我一直想做的东西来测试和扩展我的PHP知识.但是我读过并试图实现的每个在线解决方案都行不通,我不知道为什么.我有这样的逻辑:

//find game form
        print "<form method='post' action='game.php'>
        <label>Enter host generated game #</label><br>
        <label><input type='text' name='gamenumber'></label><br>
        <label><input type='submit' name='findgame' value='FindGame'></label><br><br>
        </form>";

        //host game button
        print "<form method='post' action='game.php'>
        <label><input type='submit' name='hostgame' value='HostGame'></label>
        </form>";

//game logic



if(isset($_POST['hostgame'])) 
    {
        $roomnumber = rand();
        print $roomnumber;

        insertField($Ausername,$roomnumber); //insert field GUI

        //link game to host for future field printing
        $query = "UPDATE game".$roomnumber." SET host='".$Ausername."' WHERE host='null'";
        $result = mysqli_query($link, $query);

        print "<div id='quote'>"; //populate host just disappears <meta http-equiv='refresh' content='5' />

        //populates self and …
Run Code Online (Sandbox Code Playgroud)

javascript php ajax jquery page-refresh

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

notice: undefined index: REMOTE_ADDR

I've been trying to follow this tutorial and I did everything it said. I clicked the download button, installed XAMPP, copied the directory of the only server.php file i found, and put it in the following line, and ran it in the shell like it said.

php -q c:\xampp1\php\pear\adodb\server.php

But I got a bunch of warnings about files not being included and other stuff, which i don't understand because I downloaded everything it said and followed the tutorial. This is …

php sockets xampp

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

标签 统计

javascript ×2

php ×2

ajax ×1

jquery ×1

page-refresh ×1

sockets ×1

xampp ×1