Javascript NowJS错误!我能';不要让这个例子起作用!
当我遇到一些错误时,我正在跟随教程Javascript NowJS错误!我能';不要让这个例子起作用!,javascript,node.js,Javascript,Node.js,当我遇到一些错误时,我正在跟随教程 <html> <head> <title>index.html</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"/> <script src="http://localhost:8080/NowJS/now.js"></script>
<html>
<head>
<title>index.html</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"/>
<script src="http://localhost:8080/NowJS/now.js"></script>
<script>
$(document).ready(function(){
var name = prompt("what is your name?","");
now.receiveMessage = function(name,message){
alert(name+" "+message);
};
$('.butt').click(function(){
alert($('#put').val());
now.distributeMessage(name,$('#put').val());
$('#put').val('');
});
});
</script>
我高度怀疑它与我的标签有关,因为/NowJS/now.js上没有任何内容。
有人能在这方面给我一些启发吗
在您希望使用NowJS的页面上,只需在HTML头部包含此脚本标记:NowJS仅适用于通过传递到上面的initialize函数的相同http服务器实例提供服务的页面
谢谢您的时间。在文档中,脚本标记中的路径是小写的,
/nowjs/now.js
,而在您的代码片段中是/nowjs/now.js
,因此我猜这就是它不起作用的原因 在文档中,脚本标记中的路径是小写的,/nowjs/now.js
,而在您的代码片段中是/nowjs/now.js
,因此我猜这就是它不起作用的原因
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"/>
脚本标记不能自动关闭。
脚本标记不能自动关闭
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"/>