小编use*_*176的帖子

在节点http服务器中计算访问者

我的源代码:

 var http = require("http");
 var count=1;

 http.createServer(function(request, response) {
 response.writeHead(200, {"Content-Type": "text/plain"});    
 response.write("Hi, you are number "+count+" visitors");
 response.end();
 count++;
  }).listen(8888);  
Run Code Online (Sandbox Code Playgroud)

我每次访问都得到1,3,5,7,..... 为什么要将计数增加2?

http count node.js

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

将表单发送到远程服务器

我想在我自己的网站上使用http://zxing.org/w/decode.jspx提供的服务和自定义表单.我写了以下代码:

<html>
<body>
    <FORM action="http://zxing.org/w/decode.jspx" method="post">
        <INPUT type="text" name="u" value="http://justinsomnia.org/images/qr-code-justinsomnia.png">
        <INPUT type="submit" value="Send"> 
    </FORM>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

当我提交表单时,我希望看到结果页面带有"Decode Succeeded"消息.相反,我看到我试图复制的原始远程表单.

你能发现我的自定义表格有什么问题吗?

html forms

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

标签 统计

count ×1

forms ×1

html ×1

http ×1

node.js ×1