今天小小的尝试了一小下 nodejs

<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script type="text/javascript">
function func(o){
alert(o
+"-----No JJ");
}
(
function(){
var js = document.createElement('script');
js.src
='http://127.0.0.1:8080/?name=LunHui';
document.getElementsByTagName(
'head')[0].appendChild(js);
})();
</script>
</body>
</html>
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
var url = req.url;
var name = url.toString().substring(7);
var returnStr = "func('"+name+"')";
res.end(returnStr);
}).listen(8080, "127.0.0.1");



posted @ 2011-11-05 10:09  sirzxj  阅读(267)  评论(0编辑  收藏  举报