我认为我的 html 文件看不到另一个脚本文件
I think my html file doesn't see another script file
我有这个问题.我有两个文件,一个(soap.html
(,另一个是(soap.js
(
在html文件中,我使用了一个edarah_Authenticate
的函数,这个函数存在于soap.js
中,但这是错误:
"未捕获的引用错误: 未定义edarah_Authenticate"
如何使html文件看到soap.js
文件中
这是 HTML:
<script type="text/javascript" src="soap.js"> </script>
<input type="text" name="username"
id="username" value="username" click="this.value=''" class="user-name">
<input type="password" id="password"
name="password" value="password" onclick="this.value=''" class="user-name">
<div class="login">
<input type="button" id="signin" class="sign-button" onclick="
var username=document.getElementById('username').value;
var password= document.getElementById('password').value;
edarah_Authenticate (username,password, function(jsonResponse) {
var auth = JSON.parse(jsonResponse);
for (i=0;i<auth.length;i++){
if ((msg[i]['id'])!==null)
{
Redirect();
}
else { alert('Username or Password is incorrect');}
} });">
</div>
这是soap.js
文件:
function edarah_Authenticate(username, password, theCallBack)
{
method = "Authenticate";
parameters = "<username xsi:type='xsd:string'>" + username + "</username>
<password xsi:type='xsd:string'>" + password + "</password>";
edarah_getDataFromWebService(method, parameters, theCallBack);
}
还有继续,但我认为这就足够了。
查看浏览器的错误控制台:
未捕获的语法错误:意外令牌非法
在 JavaScript 中,字符串文字中间不能有新行。这会破坏您的函数声明。
JSHint 和 JSLint 也会发现这一点(就像其他一些问题一样,例如您将全局变量用于看起来不应该是全局变量的东西(。
我想你的代码是真的.
只是你要检查两个文件夹是否在同一个目录中,我觉得这个函数是WEB服务你必须把它当成客户端来代理。
相关文章:
- 为什么我在Internet Explorer上看不到html元素
- ajax请求成功,但可以'我看不到我的数据
- 使用jQuery for RSS看不到多个帖子
- 执行此代码时,我看不到警告框
- Javascript 方法看不到对象变量
- 看不到变量
- Phantomjs 看不到 Twitter/Facebook 授权页面
- AS3 XML上的翻页在IE和FIREFOX上看不到
- JavaScript 看不到声明的变量
- 看不到函数外的Javascript变量
- Javascript对象看不到内部函数
- 为什么我的firefox扩展javascript不能访问opener窗口,也看不到window.name
- 从Node.js查询Neo4j时看不到任何回调
- I'我在css中做了一些隐藏的东西,我可以'I don’我现在点击按钮时看不到它
- PHP 看不到来自 javascript ajax FormData 的数据(输入类型文件)
- 当从主机编辑文件时,虚拟机中的Nodemon看不到更改
- IE9看不到“;文件”;在文件输入选择框中
- 我认为我的 html 文件看不到另一个脚本文件
- 如果分配给嵌套require中的变量,RequireJS R.js看不到依赖的require文件
- Firebug - 从文件运行时看不到控制台.log输出.js